1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-25 22:37:27 -04:00

New: Use ASP.NET Core instead of Nancy

This commit is contained in:
ta264
2021-10-21 21:04:19 +01:00
committed by Qstick
parent c14ef7bee7
commit 2d53ec24f8
160 changed files with 2866 additions and 3657 deletions
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.Security.Claims;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Radarr.Http.Authentication
{
public class NoAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>
{
public NoAuthenticationHandler(IAuthenticationService authService,
IOptionsMonitor<AuthenticationSchemeOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock)
: base(options, logger, encoder, clock)
{
}
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
var claims = new List<Claim>
{
new Claim("user", "Anonymous"),
new Claim("UiAuth", "true")
};
var identity = new ClaimsIdentity(claims, "NoAuth", "user", "identifier");
var principal = new ClaimsPrincipal(identity);
var ticket = new AuthenticationTicket(principal, "NoAuth");
return Task.FromResult(AuthenticateResult.Success(ticket));
}
}
}