aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
diff options
context:
space:
mode:
authorPhallacy <Dragoonmac@gmail.com>2019-02-20 00:00:26 -0800
committerPhallacy <Dragoonmac@gmail.com>2019-02-20 00:00:26 -0800
commit6bbb968b578fe42224227b70e78825bbed5cfc6f (patch)
treee77ea5c099d4517389f3c221b8b931ad83f2b7cd /Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
parent56e306334201e06f2066e1e7ca1246508346bfa9 (diff)
minor changes and return to netstandard
Diffstat (limited to 'Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs')
-rw-r--r--Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs33
1 files changed, 19 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
index 80026d97c..2ac3ef424 100644
--- a/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
+++ b/Emby.Server.Implementations/Library/DefaultAuthenticationProvider.cs
@@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.Library
string CalculatedHashString;
if (_cryptographyProvider.GetSupportedHashMethods().Contains(readyHash.Id))
{
- if (String.IsNullOrEmpty(readyHash.Salt))
+ if (string.IsNullOrEmpty(readyHash.Salt))
{
CalculatedHash = _cryptographyProvider.ComputeHash(readyHash.Id, passwordbytes);
CalculatedHashString = BitConverter.ToString(CalculatedHash).Replace("-", string.Empty);
@@ -65,7 +65,8 @@ namespace Emby.Server.Implementations.Library
{
CalculatedHash = _cryptographyProvider.ComputeHash(readyHash.Id, passwordbytes, readyHash.SaltBytes);
CalculatedHashString = BitConverter.ToString(CalculatedHash).Replace("-", string.Empty);
- }
+ }
+
if (CalculatedHashString == readyHash.Hash)
{
success = true;
@@ -95,18 +96,20 @@ namespace Emby.Server.Implementations.Library
private void ConvertPasswordFormat(User user)
{
if (!string.IsNullOrEmpty(user.Password))
+ {
+ return;
+ }
+
+ if (!user.Password.Contains("$"))
{
- if (!user.Password.Contains("$"))
- {
- string hash = user.Password;
- user.Password = String.Format("$SHA1${0}", hash);
- }
-
- if (user.EasyPassword != null && !user.EasyPassword.Contains("$"))
- {
- string hash = user.EasyPassword;
- user.EasyPassword = string.Format("$SHA1${0}", hash);
- }
+ string hash = user.Password;
+ user.Password = String.Format("$SHA1${0}", hash);
+ }
+
+ if (user.EasyPassword != null && !user.EasyPassword.Contains("$"))
+ {
+ string hash = user.EasyPassword;
+ user.EasyPassword = string.Format("$SHA1${0}", hash);
}
}
@@ -122,6 +125,7 @@ namespace Emby.Server.Implementations.Library
{
return string.IsNullOrEmpty(password);
}
+
return false;
}
@@ -188,7 +192,8 @@ namespace Emby.Server.Implementations.Library
{
ConvertPasswordFormat(user);
passwordHash = new PasswordHash(user.Password);
- }
+ }
+
if (passwordHash.SaltBytes != null)
{
//the password is modern format with PBKDF and we should take advantage of that