Table of Contents

Class TokenRequestValidationResult

Namespace
Fdyay.IdentityServer.Validation
Assembly
Fdyay.IdentityServer.Core.dll

The outcome of validating a token request.

public sealed class TokenRequestValidationResult
Inheritance
TokenRequestValidationResult
Inherited Members

Remarks

Duende 8.0.1's two constructors, measured, for a custom validator to answer with.

Constructors

TokenRequestValidationResult(ValidatedTokenRequest, Dictionary<string, object>?)

A valid request, whose response is to carry customResponse too.

public TokenRequestValidationResult(ValidatedTokenRequest validatedRequest, Dictionary<string, object>? customResponse = null)

Parameters

validatedRequest ValidatedTokenRequest
customResponse Dictionary<string, object>

TokenRequestValidationResult(ValidatedTokenRequest, string, string?, Dictionary<string, object>?)

A refused request: the client is told error, errorDescription, and customResponse.

public TokenRequestValidationResult(ValidatedTokenRequest validatedRequest, string error, string? errorDescription = null, Dictionary<string, object>? customResponse = null)

Parameters

validatedRequest ValidatedTokenRequest
error string
errorDescription string
customResponse Dictionary<string, object>

Properties

CustomResponse

Members a custom validator adds to the token response — to the error, when it refuses.

[SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "Duende's shape: a custom validator assigns it.")]
public Dictionary<string, object>? CustomResponse { get; set; }

Property Value

Dictionary<string, object>

Remarks

Duende's, written at the top level of the response beside this server's own members. Where a name is one this server writes, this server's value stands: a custom member adds to a response, it does not rewrite the token or the error in it.

Error

The OAuth error code the request was refused with (RFC 6749 §5.2), such as invalid_grant; null for a valid request.

public string? Error { get; init; }

Property Value

string

ErrorDescription

A human-readable explanation sent as error_description, when there is one.

public string? ErrorDescription { get; init; }

Property Value

string

IsError

Whether the request was refused.

public bool IsError { get; init; }

Property Value

bool

ValidatedRequest

The request, when it was validated far enough to have one. Duende's name.

public ValidatedTokenRequest? ValidatedRequest { get; init; }

Property Value

ValidatedTokenRequest

Methods

Failure(string, string?)

A refused request, with no validated request.

public static TokenRequestValidationResult Failure(string error, string? description = null)

Parameters

error string

The OAuth error code to answer with.

description string

The error_description, when there is one.

Returns

TokenRequestValidationResult

A result with IsError true.

Success(ValidatedTokenRequest)

A valid request.

public static TokenRequestValidationResult Success(ValidatedTokenRequest request)

Parameters

request ValidatedTokenRequest

The validated request.

Returns

TokenRequestValidationResult

A result with IsError false.