1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-18 21:35:51 -04:00

New: Use native dotnet host and DryIoc

(cherry picked from commit d6170dbfedf27a6218afe242a0fae2eb8b368aec)
(cherry picked from commit 7fe36a7e9222e830f4920e09a85115df0bdbf190)
This commit is contained in:
ta264
2021-10-21 21:04:26 +01:00
committed by Qstick
parent 2d53ec24f8
commit 06e2d5b3c3
77 changed files with 940 additions and 5133 deletions
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NzbDrone.Core.Configuration;
namespace Radarr.Http.Authentication
{
@@ -17,17 +18,20 @@ namespace Radarr.Http.Authentication
public string HeaderName { get; set; }
public string QueryName { get; set; }
public string ApiKey { get; set; }
}
public class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthenticationOptions>
{
private readonly string _apiKey;
public ApiKeyAuthenticationHandler(IOptionsMonitor<ApiKeyAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
ISystemClock clock,
IConfigFileProvider config)
: base(options, logger, encoder, clock)
{
_apiKey = config.ApiKey;
}
private string ParseApiKey()
@@ -56,7 +60,7 @@ namespace Radarr.Http.Authentication
return Task.FromResult(AuthenticateResult.NoResult());
}
if (Options.ApiKey == providedApiKey)
if (_apiKey == providedApiKey)
{
var claims = new List<Claim>
{