|
|
@ -6,6 +6,7 @@ using System.Text.Encodings.Web;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
|
using Microsoft.AspNetCore.Authentication;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
|
@ -20,9 +21,8 @@ namespace Radarr.Http.Authentication
|
|
|
|
public BasicAuthenticationHandler(IAuthenticationService authService,
|
|
|
|
public BasicAuthenticationHandler(IAuthenticationService authService,
|
|
|
|
IOptionsMonitor<AuthenticationSchemeOptions> options,
|
|
|
|
IOptionsMonitor<AuthenticationSchemeOptions> options,
|
|
|
|
ILoggerFactory logger,
|
|
|
|
ILoggerFactory logger,
|
|
|
|
UrlEncoder encoder,
|
|
|
|
UrlEncoder encoder)
|
|
|
|
ISystemClock clock)
|
|
|
|
: base(options, logger, encoder)
|
|
|
|
: base(options, logger, encoder, clock)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_authService = authService;
|
|
|
|
_authService = authService;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -71,7 +71,7 @@ namespace Radarr.Http.Authentication
|
|
|
|
|
|
|
|
|
|
|
|
protected override Task HandleChallengeAsync(AuthenticationProperties properties)
|
|
|
|
protected override Task HandleChallengeAsync(AuthenticationProperties properties)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Response.Headers.Add("WWW-Authenticate", $"Basic realm=\"{BuildInfo.AppName}\"");
|
|
|
|
Response.Headers.Append("WWW-Authenticate", $"Basic realm=\"{BuildInfo.AppName}\"");
|
|
|
|
Response.StatusCode = 401;
|
|
|
|
Response.StatusCode = 401;
|
|
|
|
return Task.CompletedTask;
|
|
|
|
return Task.CompletedTask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|