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.​IIdentityServerTools
Assembly: Duende.IdentityServer
Useful helpers for interacting with IdentityServer.
Methods
System.​Threading.​Tasks.​Task<​string>
IssueJwtAsync​(int lifetime,
System.​Collections.​Generic.​IEnumerable<​System.​Security.​Claims.​Claim> claims)
Issues a JWT with a specific lifetime and set of claims.
Returns A JWT that expires after the specified lifetime and contains
the given claims.
lifetime
The lifetime, in seconds, which will determine
the exp claim of the token.
claims
A collection of additional claims to include in the
token.
Remarks
Typical implementations depend on the <see cref="T:Microsoft.AspNetCore.Http.HttpContext" />
or <see cref="P:Duende.IdentityServer.Configuration.IdentityServerOptions.IssuerUri" /> to determine the issuer
of the token. Ensure that calls to this method will only occur if there
is an incoming HTTP request or with the option set.
System.​Threading.​Tasks.​Task<​string>
IssueJwtAsync​(int lifetime,
string issuer,
System.​Collections.​Generic.​IEnumerable<​System.​Security.​Claims.​Claim> claims)
Issues a JWT with a specific lifetime, issuer, and set of claims.
Returns A JWT with the specified lifetime, issuer and additional
claims.
lifetime
The lifetime, in seconds, which will determine
the exp claim of the token.
issuer
The issuer of the token, set in the iss
claim.
claims
A collection of additional claims to include in the
token.
System.​Threading.​Tasks.​Task<​string>
IssueJwtAsync​(int lifetime,
string issuer,
string tokenType,
System.​Collections.​Generic.​IEnumerable<​System.​Security.​Claims.​Claim> claims)
Issues a JWT with a specific lifetime, issuer, token type, and set of
claims.
Returns A JWT with the specified lifetime, issuer, token type, and
additional claims.
lifetime
The lifetime, in seconds, which will determine
the exp claim of the token.
issuer
The issuer of the token, set in the iss
claim.
tokenType
The token's type, such as "access_token" or
"id_token", set in the typ claim.
claims
A collection of additional claims to include in the
token.
System.​Threading.​Tasks.​Task<​string>
IssueClientJwtAsync​(string clientId,
int lifetime,
System.​Collections.​Generic.​IEnumerable?<​string> scopes = null,
System.​Collections.​Generic.​IEnumerable?<​string> audiences = null,
System.​Collections.​Generic.​IEnumerable?<​System.​Security.​Claims.​Claim> additionalClaims = null)
Issues a JWT access token for a particular client.
Returns A JWT with the specified client, lifetime, scopes, audiences,
and additional claims.
clientId
The client identifier, set in the client_id
claim.
lifetime
The lifetime, in seconds, which will determine
the exp claim of the token.
scopes
A collection of scopes, which will be added to the
token as claims with the "scope" type.
audiences
A collection of audiences, which will be added
to the token as claims with the "aud" type.
additionalClaims
A collection of additional claims to
include in the token.
Remarks
Typical implementations depend on the <see cref="T:Microsoft.AspNetCore.Http.HttpContext" />
or <see cref="P:Duende.IdentityServer.Configuration.IdentityServerOptions.IssuerUri" /> to determine the issuer
of the token. Ensure that calls to this method will only occur if there
is an incoming HTTP request or with the option set.