Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface Duende.​IdentityServer.​Services.​ITokenService

Assembly: Duende.IdentityServer

Responsible for building the <see cref="T:Duende.IdentityServer.Models.Token" /> model for identity tokens and access tokens. This is a higher-level service than <see cref="T:Duende.IdentityServer.Services.ITokenCreationService" /> : it assembles the token's claims, lifetime, and signing key information, then delegates serialization to <see cref="T:Duende.IdentityServer.Services.ITokenCreationService" /> . Implement or override this service to customize how token models are constructed before they are signed and serialized.

Methods

CreateIdentityTokenAsync​(Models.​TokenCreationRequest request, System.​Threading.​CancellationToken ct)
Creates an identity token model for the given request. The resulting <see cref="T:Duende.IdentityServer.Models.Token" /> contains the user's identity claims and is intended to be serialized into a signed JWT by <see cref="T:Duende.IdentityServer.Services.ITokenCreationService" /> .
Returns A <see cref="T:Duende.IdentityServer.Models.Token" /> model representing the identity token, ready to be serialized by <see cref="M:Duende.IdentityServer.Services.ITokenService.CreateSecurityTokenAsync(Duende.IdentityServer.Models.Token,System.Threading.CancellationToken)" /> .
request The token creation request containing the subject, client, requested resources, and other parameters needed to build the identity token.
ct The cancellation token.
CreateAccessTokenAsync​(Models.​TokenCreationRequest request, System.​Threading.​CancellationToken ct)
Creates an access token model for the given request. The resulting <see cref="T:Duende.IdentityServer.Models.Token" /> contains the authorized scopes and claims and is intended to be serialized into a signed JWT or stored as a reference token.
Returns A <see cref="T:Duende.IdentityServer.Models.Token" /> model representing the access token, ready to be serialized by <see cref="M:Duende.IdentityServer.Services.ITokenService.CreateSecurityTokenAsync(Duende.IdentityServer.Models.Token,System.Threading.CancellationToken)" /> .
request The token creation request containing the subject, client, requested resources, and other parameters needed to build the access token.
ct The cancellation token.
CreateSecurityTokenAsync​(Models.​Token token, System.​Threading.​CancellationToken ct)
Serializes and protects the given <see cref="T:Duende.IdentityServer.Models.Token" /> model into its wire format. For JWT tokens this produces a compact signed JWT string; for reference tokens the token is stored in the grant store and the returned value is the reference handle.
Returns The serialized token string to return to the client — either a compact JWT or an opaque reference token handle, depending on the token's access token type.
token The token model to serialize and protect.
ct The cancellation token.