Table of Contents

Interface ISamlSigninStateStore

Namespace
Fdyay.IdentityServer.Saml.Stores
Assembly
Fdyay.IdentityServer.Saml.dll

Holds a validated sign-on request across the detour through the login page.

public interface ISamlSigninStateStore

Remarks

TakeAsync(string, CancellationToken) must be a one-time consume: the reference travels through the browser, and a return URL left in history would otherwise be a replayable authorization. Provide a distributed implementation for multi-instance hosting — a user can sign in on whichever instance the balancer picks.

Methods

PeekAsync(string, CancellationToken)

Returns the state for key without consuming it, or null if absent.

Task<SamlSignInState?> PeekAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string
cancellationToken CancellationToken

Returns

Task<SamlSignInState>

Remarks

For the login page, which needs to say which service provider is waiting and may be rendered more than once for one sign-in — a mistyped password renders it again. Consuming it there would leave the endpoint with nothing to resume when the user finally succeeds. The pushed-authorization reference on the OpenID Connect side is read the same way and for the same reason.

StoreAsync(string, SamlSignInState, CancellationToken)

Stores state under key, an opaque reference, replacing any state already there.

Task StoreAsync(string key, SamlSignInState state, CancellationToken cancellationToken = default)

Parameters

key string
state SamlSignInState
cancellationToken CancellationToken

Returns

Task

Remarks

Replacing is what records a denial: the state is read with PeekAsync(string, CancellationToken), given its DenialError and stored back under its key.

TakeAsync(string, CancellationToken)

Atomically removes and returns the state for key, or null if absent.

Task<SamlSignInState?> TakeAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string
cancellationToken CancellationToken

Returns

Task<SamlSignInState>