Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface Duende.​IdentityServer.​Validation.​ICustomTokenRequestValidator

Assembly: Duende.IdentityServer

Allows inserting custom validation logic into token requests at the token endpoint.

Remarks

Implement this interface to run custom code as part of the token issuance pipeline. <see cref="M:Duende.IdentityServer.Validation.ICustomTokenRequestValidator.ValidateAsync(Duende.IdentityServer.Validation.CustomTokenRequestValidationContext,System.Threading.CancellationToken)" /> is called during token request processing, after all built-in validation has succeeded. The context provides access to the validated request and the response that will be sent to the client. <para> Within the method you can inspect and modify request parameters such as the token lifetime, token type, confirmation method, and client claims. Use the <c>CustomResponse</c> dictionary on the context to emit additional fields in the token endpoint response. </para> <para> To fail the request, set <c>IsError</c>, <c>Error</c>, and optionally <c>ErrorDescription</c> on the <c>Result</c> object of the <see cref="T:Duende.IdentityServer.Validation.CustomTokenRequestValidationContext" />. </para> <para> Register implementations using <c>AddCustomTokenRequestValidator&lt;T&gt;()</c> on the IdentityServer builder. Multiple implementations may be registered and are all invoked. </para>

Methods

ValidateAsync​(CustomTokenRequestValidationContext context, System.​Threading.​CancellationToken ct)
Executes custom validation logic for a token request.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that completes when validation is finished.
context The validation context, providing access to the validated token request and the response that will be returned to the client. Use <c>context.Result</c> to signal failure or to modify response fields.
ct The cancellation token.