Skip to content
We just launched Duende IdentityServer v7.2.0 and BFF v3.0. Check it out!

Extension Grant Validator

Duende.IdentityServer.Validation.IExtensionGrantValidator

Section titled “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 method 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:

Program.cs
builder.AddExtensionGrantValidator<MyValidator>();