Aller au contenu
Cette page n'a pas encore été traduite.

ISecurityEventTokenValidator Interface

One check in the validation pipeline. The validator runs steps in order and stops at the first error, so a step sees only tokens that survived everything before it.

C#
public interface ISecurityEventTokenValidator

Derived
↳ ForbidNonceStep
↳ LogoutEventStep
↳ LogoutTokenExpiryStep
↳ LogoutTokenTypeStep
↳ SubjectOrSessionStep
↳ CompositeSecurityEventTokenValidator
↳ ISecurityCriticalValidator
↳ AudienceStep
↳ EventsPresenceStep
↳ ExpAbsenceStep
↳ IssuedAtWindowStep
↳ IssuerAllowlistStep
↳ JwtIdPresenceStep
↳ ParseStep
↳ PayloadDeserializationStep
↳ SignatureStep
↳ TimeOfEventStep
↳ TypHeaderStep

Remarks

A step's contract, beyond the signature: declare the facts your safety depends on through Require(SecurityEventTokenValidationStates) before reading them, record what you proved through Establish(SecurityEventTokenValidationStates), and stay free of side effects - validation answers "is this token acceptable", and anything that changes the world on the strength of that answer (registering a replay identifier, invalidating a cache) belongs after the verdict, in the consumer. That split is why replay protection is not a step: registering a "jti" is a mutation, and a pipeline that mutated on a token later steps might still reject would need an undo.

The return type is System.Threading.Tasks.ValueTask<> deliberately: all but one of the default steps answer synchronously - only signature verification performs I/O, for key retrieval - and the pipeline calls every step on every token, so a System.Threading.Tasks.Task<> here would allocate once per synchronous step per token for nothing. The usual ValueTask hazard, a second await, has no doorway: the composite and the guard each await a step exactly once.

Methods

ISecurityEventTokenValidator.ValidateAsync(SecurityEventTokenValidationContext, CancellationToken) Method

Checks the token in flight.

C#
System.Threading.Tasks.ValueTask<Abblix.SecurityEvents.Validation.SecurityEventTokenValidationError?> ValidateAsync(Abblix.SecurityEvents.Validation.SecurityEventTokenValidationContext context, System.Threading.CancellationToken cancellationToken);

Parameters

context SecurityEventTokenValidationContext

The state accumulated by earlier steps.

cancellationToken System.Threading.CancellationToken

Cancels I/O the step performs, such as key retrieval.

Returns

System.Threading.Tasks.ValueTask<SecurityEventTokenValidationError>
Null to pass the token on; an error to stop the pipeline with that verdict.