Table of Contents

Class SessionStoreSignInValidator

Namespace
Arc4u.Blazor
Assembly
Arc4u.OAuth2.AspNetCore.Blazor.dll

Checks the sign-in against the session store of the authentication cookie: the sign-in exists as long as the store still holds the ticket whose key the principal carries (the SessionKey claim, stamped by SessionKeyTicketStore, which AddAppPrincipalCircuitRevalidation wraps around the cookie's session store).

public sealed class SessionStoreSignInValidator : ISignInValidator
Inheritance
SessionStoreSignInValidator
Implements
Inherited Members

Remarks

Sign-out removes the ticket from the store, and so does its expiry, so the check follows both. The ticket belongs to that sign-in alone: a sign-out ends the circuits of that browser session, not the other sessions of the same user.

The sign-in is ended when the store no longer holds the ticket, when the ticket has expired, or when it belongs to another user. When the principal carries no session key or the cookie has no session store (the whole ticket is then in the cookie, and the server keeps nothing to check against), the sign-in is considered alive: there is nothing to check, and the user keeps the circuit until it reconnects.

Constructors

SessionStoreSignInValidator(IOptionsMonitor<CookieAuthenticationOptions>, IOptions<CircuitRevalidationOptions>, ILogger<SessionStoreSignInValidator>)

Initializes a new instance of the SessionStoreSignInValidator class.

public SessionStoreSignInValidator(IOptionsMonitor<CookieAuthenticationOptions> cookieOptions, IOptions<CircuitRevalidationOptions> options, ILogger<SessionStoreSignInValidator> logger)

Parameters

cookieOptions IOptionsMonitor<CookieAuthenticationOptions>

The cookie options, giving the session store.

options IOptions<CircuitRevalidationOptions>

The circuit revalidation options, giving the cookie scheme.

logger ILogger<SessionStoreSignInValidator>

The logger.

Methods

IsSignInAliveAsync(ClaimsPrincipal, CancellationToken)

Tells whether the sign-in behind user still exists.

public Task<bool> IsSignInAliveAsync(ClaimsPrincipal user, CancellationToken cancellationToken)

Parameters

user ClaimsPrincipal

The user of the circuit.

cancellationToken CancellationToken

A token to cancel the check (the circuit is closing).

Returns

Task<bool>

true when the sign-in still exists; false to turn the circuit anonymous. An exception also turns it anonymous.