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
claimsServiceIClaimsServiceWhat assembles each token's claims.
tokenCreationServiceITokenCreationServiceWhat signs a JWT.
referenceTokenStoreIReferenceTokenStoreWhere a reference access token is stored.
keysIKeyMaterialServiceThe signing keys, asked which algorithm an identity token will be signed with so its hash claims match it.
timeTimeProviderThe clock a token's creation time is read from.
optionsIOptions<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
requestTokenCreationRequestWhat the token is for.
cancellationTokenCancellationTokenCancels 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
requestTokenCreationRequestWhat the token is for.
cancellationTokenCancellationTokenCancels 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
tokenTokencancellationTokenCancellationToken