Skip to main content

INonceService Interface

Abblix.Oidc.Server

Abblix.Oidc.Server.Features.Nonces

INonceService Interface

Issues and validates server-issued opaque, time-bounded nonces. The current consumer is DPoP-Nonce per RFC 9449 §8 / §9 — the server returns a nonce via the DPoP-Nonce response header and the client echoes it back in the nonce claim of a subsequent DPoP proof to prove freshness — but the primitive is intentionally generic: any future feature needing challenge-response freshness checks can resolve the same service.

public interface INonceService

Derived
RollingHmacNonceService

Remarks

The default implementation is stateless modulo a short-lived rotating HMAC secret stored in IDistributedCache. No per-nonce state is kept, so ValidateAsync(string, CancellationToken) does not enforce single-use; replay protection at the proof level is handled separately by the jti replay cache.

Methods

INonceService.IssueAsync(CancellationToken) Method

Mints a fresh nonce string suitable for the DPoP-Nonce response header. The returned value is opaque to callers — clients must echo it verbatim.

System.Threading.Tasks.Task<string> IssueAsync(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

cancellationToken System.Threading.CancellationToken

Returns

System.Threading.Tasks.Task<System.String>

INonceService.ValidateAsync(string, CancellationToken) Method

Verifies that nonce was issued by this deployment and is still within the acceptance window.

System.Threading.Tasks.Task<System.Nullable<Abblix.Oidc.Server.Features.Nonces.NonceValidationFailure>> ValidateAsync(string nonce, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

nonce System.String

The nonce string echoed by the client in its DPoP proof nonce claim.

cancellationToken System.Threading.CancellationToken

Cancellation token.

Returns

System.Threading.Tasks.Task<System.Nullable<NonceValidationFailure>>
null when the nonce is acceptable, otherwise a NonceValidationFailure describing why it is not.