mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 05:18:27 +01:00
@@ -1,3 +1,5 @@
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -36,19 +38,19 @@ using Microsoft.Extensions.Logging;
|
||||
namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UserManager
|
||||
/// Class UserManager.
|
||||
/// </summary>
|
||||
public class UserManager : IUserManager
|
||||
{
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// The logger.
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly object _policySyncLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the active user repository
|
||||
/// Gets the active user repository.
|
||||
/// </summary>
|
||||
/// <value>The user repository.</value>
|
||||
private readonly IUserRepository _userRepository;
|
||||
@@ -354,6 +356,8 @@ namespace Emby.Server.Implementations.Library
|
||||
return success ? user : null;
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
||||
private static string GetAuthenticationProviderId(IAuthenticationProvider provider)
|
||||
{
|
||||
return provider.GetType().FullName;
|
||||
@@ -374,7 +378,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetPasswordResetProviders(user)[0];
|
||||
}
|
||||
|
||||
private IAuthenticationProvider[] GetAuthenticationProviders(User user)
|
||||
private IAuthenticationProvider[] GetAuthenticationProviders(User? user)
|
||||
{
|
||||
var authenticationProviderId = user?.Policy.AuthenticationProviderId;
|
||||
|
||||
@@ -395,7 +399,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return providers;
|
||||
}
|
||||
|
||||
private IPasswordResetProvider[] GetPasswordResetProviders(User user)
|
||||
private IPasswordResetProvider[] GetPasswordResetProviders(User? user)
|
||||
{
|
||||
var passwordResetProviderId = user?.Policy.PasswordResetProviderId;
|
||||
|
||||
@@ -414,7 +418,11 @@ namespace Emby.Server.Implementations.Library
|
||||
return providers;
|
||||
}
|
||||
|
||||
private async Task<(string username, bool success)> AuthenticateWithProvider(IAuthenticationProvider provider, string username, string password, User resolvedUser)
|
||||
private async Task<(string username, bool success)> AuthenticateWithProvider(
|
||||
IAuthenticationProvider provider,
|
||||
string username,
|
||||
string password,
|
||||
User? resolvedUser)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -438,15 +446,15 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<(IAuthenticationProvider authenticationProvider, string username, bool success)> AuthenticateLocalUser(
|
||||
private async Task<(IAuthenticationProvider? authenticationProvider, string username, bool success)> AuthenticateLocalUser(
|
||||
string username,
|
||||
string password,
|
||||
string hashedPassword,
|
||||
User user,
|
||||
User? user,
|
||||
string remoteEndPoint)
|
||||
{
|
||||
bool success = false;
|
||||
IAuthenticationProvider authenticationProvider = null;
|
||||
IAuthenticationProvider? authenticationProvider = null;
|
||||
|
||||
foreach (var provider in GetAuthenticationProviders(user))
|
||||
{
|
||||
@@ -543,6 +551,8 @@ namespace Emby.Server.Implementations.Library
|
||||
_users[user.Id] = user;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
|
||||
public UserDto GetUserDto(User user, string remoteEndPoint = null)
|
||||
{
|
||||
if (user == null)
|
||||
|
||||
Reference in New Issue
Block a user