Merge pull request #1926 from Bond-009/auth

Add clearer exceptions, warnings and docs
This commit is contained in:
dkanada
2019-11-23 01:14:32 +09:00
committed by GitHub
10 changed files with 63 additions and 57 deletions

View File

@@ -60,13 +60,13 @@ namespace MediaBrowser.Common.Cryptography
/// <value>Return the hashed password.</value>
public byte[] Hash { get; }
public static PasswordHash Parse(string storageString)
public static PasswordHash Parse(string hashString)
{
string[] splitted = storageString.Split('$');
string[] splitted = hashString.Split('$');
// The string should at least contain the hash function and the hash itself
if (splitted.Length < 3)
{
throw new ArgumentException("String doesn't contain enough segments", nameof(storageString));
throw new ArgumentException("String doesn't contain enough segments", nameof(hashString));
}
// Start at 1, the first index shouldn't contain any data