Table of Contents

Class AccessTokenValidationResult

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

The outcome of validating an access token.

public sealed class AccessTokenValidationResult
Inheritance
AccessTokenValidationResult
Inherited Members

Properties

Audiences

The audiences the token was issued for.

public IReadOnlyCollection<string> Audiences { get; init; }

Property Value

IReadOnlyCollection<string>

Remarks

Beside the claims rather than left inside them, because only one of the two token forms carries them there. A JWT states its audiences in aud; a reference token keeps them in Audiences and its stored claims have no aud at all. A caller that asked the claims would therefore get the right answer for one form and silence for the other — and silence, to a check deciding who may read a token, reads as "no audience" rather than "not recorded here". This property is the same answer for both.

Claims

The token's claims — a JWT's payload, or a reference token's stored claims.

public IReadOnlyCollection<Claim> Claims { get; init; }

Property Value

IReadOnlyCollection<Claim>

Error

The error code a refused token was refused with; null for a valid token.

public string? Error { get; init; }

Property Value

string

Remarks

The default validator answers invalid_request for a missing token (RFC 6750 §3.1: nothing was presented), expired_token for an expired JWT, and invalid_token for every other refusal — a JWT that does not validate, a token that is not an access token, an unknown reference handle, an over-long token, an ended session or an inactive user — as Duende 8.0.1's TokenValidator does (since 0.174.0).

IsError

Whether the token was refused.

public bool IsError { get; init; }

Property Value

bool

Methods

Failure(string)

A refused token.

public static AccessTokenValidationResult Failure(string error)

Parameters

error string

The error code, such as invalid_token.

Returns

AccessTokenValidationResult

A result with IsError true and no claims.

Success(IReadOnlyCollection<Claim>, IReadOnlyCollection<string>?)

A valid token.

public static AccessTokenValidationResult Success(IReadOnlyCollection<Claim> claims, IReadOnlyCollection<string>? audiences = null)

Parameters

claims IReadOnlyCollection<Claim>

The token's claims.

audiences IReadOnlyCollection<string>

The audiences the token was issued for; null for none.

Returns

AccessTokenValidationResult

A result with IsError false.