Table of Contents

Class DefaultTokenService

Namespace
Fdyay.IdentityServer.Services.Tokens
Assembly
Fdyay.IdentityServer.Core.dll

Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.

public sealed class DefaultTokenService : ITokenService
Inheritance
DefaultTokenService
Implements
Inherited Members

Constructors

DefaultTokenService(IClaimsService, ITokenCreationService, IReferenceTokenStore, IKeyMaterialService, TimeProvider, IOptions<IdentityServerOptions>)

A token service built from the claims, signing and reference-token services.

public DefaultTokenService(IClaimsService claimsService, ITokenCreationService tokenCreationService, IReferenceTokenStore referenceTokenStore, IKeyMaterialService keys, TimeProvider time, IOptions<IdentityServerOptions> options)

Parameters

claimsService IClaimsService

What assembles each token's claims.

tokenCreationService ITokenCreationService

What signs a JWT.

referenceTokenStore IReferenceTokenStore

Where a reference access token is stored.

keys IKeyMaterialService

The signing keys, asked which algorithm an identity token will be signed with so its hash claims match it.

time TimeProvider

The clock a token's creation time is read from.

options IOptions<IdentityServerOptions>

The server's options; EmitStaticAudienceClaim adds the static audience.

Methods

CreateAccessTokenAsync(TokenCreationRequest, CancellationToken)

Builds, unsigned, the access token a request is granted: its claims, audiences, lifetime and allowed signing algorithms.

public Task<Token> CreateAccessTokenAsync(TokenCreationRequest request, CancellationToken cancellationToken = default)

Parameters

request TokenCreationRequest

What the token is for.

cancellationToken CancellationToken

Cancels the claims lookup.

Returns

Task<Token>

The token, ready for CreateSecurityTokenAsync(Token, CancellationToken).

Exceptions

InvalidOperationException

The request's API resources name signing algorithms no one token can satisfy.

CreateIdentityTokenAsync(TokenCreationRequest, CancellationToken)

Builds, unsigned, the identity token a request is granted, with the client as its audience.

public Task<Token> CreateIdentityTokenAsync(TokenCreationRequest request, CancellationToken cancellationToken = default)

Parameters

request TokenCreationRequest

What the token is for.

cancellationToken CancellationToken

Cancels the claims and signing-key lookups.

Returns

Task<Token>

The token, ready for CreateSecurityTokenAsync(Token, CancellationToken).

CreateSecurityTokenAsync(Token, CancellationToken)

Serializes a token to a JWT, or to an opaque handle for reference access tokens.

public Task<string> CreateSecurityTokenAsync(Token token, CancellationToken cancellationToken = default)

Parameters

token Token
cancellationToken CancellationToken

Returns

Task<string>