Updated MoonCore dependencies. Switched to asp.net core native authentication scheme abstractions. Updated claim usage in frontend
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace Moonlight.ApiServer.Implementations.LocalAuth;
|
||||
|
||||
public static class LocalAuthConstants
|
||||
{
|
||||
public const string AuthenticationScheme = "LocalAuth";
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Text.Encodings.Web;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Moonlight.ApiServer.Implementations.LocalAuth;
|
||||
|
||||
public class LocalAuthHandler : AuthenticationHandler<LocalAuthOptions>
|
||||
{
|
||||
public LocalAuthHandler(
|
||||
IOptionsMonitor<LocalAuthOptions> options,
|
||||
ILoggerFactory logger,
|
||||
UrlEncoder encoder
|
||||
) : base(options, logger, encoder)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
return Task.FromResult(
|
||||
AuthenticateResult.Fail("Local authentication does not directly support AuthenticateAsync")
|
||||
);
|
||||
}
|
||||
|
||||
protected override async Task HandleChallengeAsync(AuthenticationProperties properties)
|
||||
{
|
||||
await Results
|
||||
.Redirect("/api/localAuth")
|
||||
.ExecuteAsync(Context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
||||
namespace Moonlight.ApiServer.Implementations.LocalAuth;
|
||||
|
||||
public class LocalAuthOptions : AuthenticationSchemeOptions
|
||||
{
|
||||
public string? SignInScheme { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user