Version 6.x has been out of support since May 14, 2024, and this corresponding section of the documentation is no longer maintained. We strongly recommend you upgrade to the latest supported version of 7.x and read the latest version of this documentation.

Extension Grant Validator

Duende.IdentityServer.Validation.IExtensionGrantValidator

Use an implementation of this interface to handle extension grants.

public interface IExtensionGrantValidator
{
    /// <summary>
    /// Handles the custom grant request.
    /// </summary>
    /// <param name="request">The validation context.</param>
    Task ValidateAsync(ExtensionGrantValidationContext context);

    /// <summary>
    /// Returns the grant type this validator can deal with
    /// </summary>
    /// <value>
    /// The type of the grant.
    /// </value>
    string GrantType { get; }
}
  • GrantType

    Specifies the name of the extension grant that the implementation wants to register for.

  • ValidateAsync

    This methods gets called at runtime, when a request comes in that is using the registered extension grant. The job of this method is to validate the request and to populate ExtensionGrantValidationContext.Result with a grant validation result

The instance of the extension grant validator gets registered with:

builder.AddExtensionGrantValidator<MyValidator>();