Class PanelAuthenticationHandler
- Namespace
- FishMMO.ControlPanel.Auth
- Assembly
- FishMMO-ControlPanel.dll
Turns the panel's session cookie into a ClaimsPrincipal.
public sealed class PanelAuthenticationHandler : AuthenticationHandler<AuthenticationSchemeOptions>, IAuthenticationHandler
- Inheritance
-
PanelAuthenticationHandler
- Implements
- Inherited Members
Remarks
The access level is re-read from the account on every request rather than trusted from the session row. A demotion, a ban, or a level change must take effect on the operator's very next click, not when their session happens to expire.
Constructors
PanelAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions>, ILoggerFactory, UrlEncoder, PanelSessionManager, IAccountService)
public PanelAuthenticationHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, PanelSessionManager sessionManager, IAccountService accounts)
Parameters
optionsIOptionsMonitor<AuthenticationSchemeOptions>loggerILoggerFactoryencoderUrlEncodersessionManagerPanelSessionManageraccountsIAccountService
Fields
SchemeName
Scheme name, referenced by the authorization policies.
public const string SchemeName = "FishMMOPanel"
Field Value
UnavailableKey
Marks a request whose session could not be checked because the database did not answer.
public const string UnavailableKey = "fishmmo:auth-unavailable"
Field Value
Remarks
Such a request is unauthenticated for this request only: its cookie is kept and its session
row untouched. The challenge answers 503 instead of 401 when this is set, so the page says
"try again" rather than "sign in", and api/auth/session does the same.
Methods
HandleAuthenticateAsync()
Allows derived types to handle authentication.
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
Returns
HandleChallengeAsync(AuthenticationProperties)
Override this method to deal with 401 challenge concerns, if an authentication scheme in question deals an authentication interaction as part of it's request flow. (like adding a response header, or changing the 401 result to 302 of a login page or external sign-in location.)
protected override Task HandleChallengeAsync(AuthenticationProperties properties)
Parameters
propertiesAuthenticationProperties
Returns
- Task
A Task.
HandleForbiddenAsync(AuthenticationProperties)
Override this method to handle Forbid.
protected override Task HandleForbiddenAsync(AuthenticationProperties properties)
Parameters
propertiesAuthenticationProperties
Returns
- Task
A Task.