mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 03:52:33 +02:00
Reloading the page before restarting won't break the UI when changing authentication method
This commit is contained in:
parent
27d3ecf6b2
commit
344f3d66ef
@ -21,18 +21,21 @@ public class AuthenticationService : IAuthenticationService
|
|||||||
private readonly IConfigFileProvider _configFileProvider;
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private static readonly NzbDroneUser AnonymousUser = new NzbDroneUser { UserName = "Anonymous" };
|
private static readonly NzbDroneUser AnonymousUser = new NzbDroneUser { UserName = "Anonymous" };
|
||||||
|
|
||||||
private static String API_KEY;
|
private static String API_KEY;
|
||||||
|
private static AuthenticationType AUTH_METHOD;
|
||||||
|
|
||||||
public AuthenticationService(IConfigFileProvider configFileProvider, IUserService userService)
|
public AuthenticationService(IConfigFileProvider configFileProvider, IUserService userService)
|
||||||
{
|
{
|
||||||
_configFileProvider = configFileProvider;
|
_configFileProvider = configFileProvider;
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
API_KEY = configFileProvider.ApiKey;
|
API_KEY = configFileProvider.ApiKey;
|
||||||
|
AUTH_METHOD = configFileProvider.AuthenticationMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IUserIdentity Validate(string username, string password)
|
public IUserIdentity Validate(string username, string password)
|
||||||
{
|
{
|
||||||
if (_configFileProvider.AuthenticationMethod == AuthenticationType.None)
|
if (AUTH_METHOD == AuthenticationType.None)
|
||||||
{
|
{
|
||||||
return AnonymousUser;
|
return AnonymousUser;
|
||||||
}
|
}
|
||||||
@ -49,7 +52,7 @@ public IUserIdentity Validate(string username, string password)
|
|||||||
|
|
||||||
public IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context)
|
public IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context)
|
||||||
{
|
{
|
||||||
if (_configFileProvider.AuthenticationMethod == AuthenticationType.None)
|
if (AUTH_METHOD == AuthenticationType.None)
|
||||||
{
|
{
|
||||||
return AnonymousUser;
|
return AnonymousUser;
|
||||||
}
|
}
|
||||||
@ -73,7 +76,7 @@ public bool IsAuthenticated(NancyContext context)
|
|||||||
return ValidApiKey(apiKey);
|
return ValidApiKey(apiKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_configFileProvider.AuthenticationMethod == AuthenticationType.None)
|
if (AUTH_METHOD == AuthenticationType.None)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user