Table of Contents

Class GrantValidationResult

Namespace
Duende.IdentityServer.Validation
Assembly
Duende.IdentityServer.dll

Models the result of custom grant validation.

public class GrantValidationResult : ValidationResult
Inheritance
GrantValidationResult
Inherited Members

Constructors

GrantValidationResult(TokenRequestErrors, string, Dictionary<string, object>)

Initializes a new instance of the GrantValidationResult class with an error and description.

public GrantValidationResult(TokenRequestErrors error, string errorDescription = null, Dictionary<string, object> customResponse = null)

Parameters

error TokenRequestErrors

The error.

errorDescription string

The error description.

customResponse Dictionary<string, object>

Custom response elements

GrantValidationResult(Dictionary<string, object>)

Initializes a new instance of the GrantValidationResult class with no subject. Warning: the resulting access token will only contain the client identity.

public GrantValidationResult(Dictionary<string, object> customResponse = null)

Parameters

customResponse Dictionary<string, object>

GrantValidationResult(ClaimsPrincipal, Dictionary<string, object>)

Initializes a new instance of the GrantValidationResult class with a given principal. Warning: the principal needs to include the required claims - it is recommended to use the other constructor that does validation.

public GrantValidationResult(ClaimsPrincipal principal, Dictionary<string, object> customResponse = null)

Parameters

principal ClaimsPrincipal
customResponse Dictionary<string, object>

GrantValidationResult(string, string, IEnumerable<Claim>, string, Dictionary<string, object>)

Initializes a new instance of the GrantValidationResult class.

public GrantValidationResult(string subject, string authenticationMethod, IEnumerable<Claim> claims = null, string identityProvider = "local", Dictionary<string, object> customResponse = null)

Parameters

subject string

The subject claim used to uniquely identifier the user.

authenticationMethod string

The authentication method which describes the custom grant type.

claims IEnumerable<Claim>

Additional claims that will be maintained in the principal. If you want these claims to appear in token, you need to add them explicitly in your custom implementation of IProfileService service.

identityProvider string

The identity provider.

customResponse Dictionary<string, object>

The custom response.

GrantValidationResult(string, string, DateTime, IEnumerable<Claim>, string, Dictionary<string, object>)

Initializes a new instance of the GrantValidationResult class.

public GrantValidationResult(string subject, string authenticationMethod, DateTime authTime, IEnumerable<Claim> claims = null, string identityProvider = "local", Dictionary<string, object> customResponse = null)

Parameters

subject string

The subject claim used to uniquely identifier the user.

authenticationMethod string

The authentication method which describes the custom grant type.

authTime DateTime

The UTC date/time of authentication.

claims IEnumerable<Claim>

Additional claims that will be maintained in the principal. If you want these claims to appear in token, you need to add them explicitly in your custom implementation of IProfileService service.

identityProvider string

The identity provider.

customResponse Dictionary<string, object>

The custom response.

Properties

CustomResponse

Custom fields for the token response

public Dictionary<string, object> CustomResponse { get; set; }

Property Value

Dictionary<string, object>

Subject

Gets or sets the principal which represents the result of the validation.

public ClaimsPrincipal Subject { get; set; }

Property Value

ClaimsPrincipal

The principal.