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.​IExtensionGrantValidator
Assembly: Duende.IdentityServer
Handles validation of token requests that use a custom (extension) OAuth grant type.
Remarks
Implement this interface to support a custom OAuth 2.0 extension grant type at the token endpoint.
IdentityServer routes incoming token requests whose <c>grant_type</c> parameter matches
<see cref="P:Duende.IdentityServer.Validation.IExtensionGrantValidator.GrantType" /> to the corresponding <see cref="T:Duende.IdentityServer.Validation.IExtensionGrantValidator" /> implementation.
<para>
<see cref="M:Duende.IdentityServer.Validation.IExtensionGrantValidator.ValidateAsync(Duende.IdentityServer.Validation.ExtensionGrantValidationContext,System.Threading.CancellationToken)" /> is responsible for authenticating the request — for example by
validating a custom credential or exchanging an external token — and then populating
<c>ExtensionGrantValidationContext.Result</c> with a <c>GrantValidationResult</c> that
identifies the subject (user) on whose behalf the token should be issued.
</para> <para>
To fail the request, create a <c>GrantValidationResult</c> with an appropriate
<c>TokenRequestErrors</c> value and assign it to <c>context.Result</c>.
</para> <para>
Register implementations using <c>AddExtensionGrantValidator<T>()</c> on the
IdentityServer builder.
</para>
Properties
string
GrantType
Gets the custom grant type name that this validator handles.
Remarks The value must match the <c>grant_type</c> parameter sent by the client in the token request.
The client must also be configured with this grant type in its <c>AllowedGrantTypes</c> list.
Methods
ValidateAsync​(ExtensionGrantValidationContext context,
System.​Threading.​CancellationToken ct)
Validates a token request that uses the custom grant type identified by <see cref="P:Duende.IdentityServer.Validation.IExtensionGrantValidator.GrantType" /> .
Returns A <see cref="T:System.Threading.Tasks.Task" /> that completes when validation is finished.
context
The validation context, providing access to the raw and validated token request parameters.
Set <c>context.Result</c> to a <c>GrantValidationResult</c> to indicate success or failure.
ct
The cancellation token.