Interface IIdentityServerTools
- Namespace
- Duende.IdentityServer
- Assembly
- Duende.IdentityServer.dll
Useful helpers for interacting with IdentityServer.
public interface IIdentityServerTools
Methods
IssueClientJwtAsync(string, int, IEnumerable<string>?, IEnumerable<string>?, IEnumerable<Claim>?)
Issues a JWT access token for a particular client.
Task<string> IssueClientJwtAsync(string clientId, int lifetime, IEnumerable<string>? scopes = null, IEnumerable<string>? audiences = null, IEnumerable<Claim>? additionalClaims = null)
Parameters
clientId
stringThe client identifier, set in the client_id claim.
lifetime
intThe lifetime, in seconds, which will determine the exp claim of the token.
scopes
IEnumerable<string>A collection of scopes, which will be added to the token as claims with the "scope" type.
audiences
IEnumerable<string>A collection of audiences, which will be added to the token as claims with the "aud" type.
additionalClaims
IEnumerable<Claim>A collection of additional claims to include in the token.
Returns
Remarks
Typical implementations depend on the HttpContext or 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.
IssueJwtAsync(int, IEnumerable<Claim>)
Issues a JWT with a specific lifetime and set of claims.
Task<string> IssueJwtAsync(int lifetime, IEnumerable<Claim> claims)
Parameters
lifetime
intThe lifetime, in seconds, which will determine the exp claim of the token.
claims
IEnumerable<Claim>A collection of additional claims to include in the token.
Returns
Remarks
Typical implementations depend on the HttpContext or 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.
IssueJwtAsync(int, string, IEnumerable<Claim>)
Issues a JWT with a specific lifetime, issuer, and set of claims.
Task<string> IssueJwtAsync(int lifetime, string issuer, IEnumerable<Claim> claims)
Parameters
lifetime
intThe lifetime, in seconds, which will determine the exp claim of the token.
issuer
stringThe issuer of the token, set in the iss claim.
claims
IEnumerable<Claim>A collection of additional claims to include in the token.
Returns
IssueJwtAsync(int, string, string, IEnumerable<Claim>)
Issues a JWT with a specific lifetime, issuer, token type, and set of claims.
Task<string> IssueJwtAsync(int lifetime, string issuer, string tokenType, IEnumerable<Claim> claims)
Parameters
lifetime
intThe lifetime, in seconds, which will determine the exp claim of the token.
issuer
stringThe issuer of the token, set in the iss claim.
tokenType
stringThe token's type, such as "access_token" or "id_token", set in the typ claim.
claims
IEnumerable<Claim>A collection of additional claims to include in the token.