Interface IIdentityServerTools
- Namespace
- Duende.IdentityServer
- Assembly
- Duende.IdentityServer.dll
Useful helpers for interacting with IdentityServer.
public interface IIdentityServerToolsMethods
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
- clientIdstring
- The client identifier, set in the client_id claim. 
- lifetimeint
- The lifetime, in seconds, which will determine the exp claim of the token. 
- scopesIEnumerable<string>
- A collection of scopes, which will be added to the token as claims with the "scope" type. 
- audiencesIEnumerable<string>
- A collection of audiences, which will be added to the token as claims with the "aud" type. 
- additionalClaimsIEnumerable<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
- lifetimeint
- The lifetime, in seconds, which will determine the exp claim of the token. 
- claimsIEnumerable<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
- lifetimeint
- The lifetime, in seconds, which will determine the exp claim of the token. 
- issuerstring
- The issuer of the token, set in the iss claim. 
- claimsIEnumerable<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
- lifetimeint
- The lifetime, in seconds, which will determine the exp claim of the token. 
- issuerstring
- The issuer of the token, set in the iss claim. 
- tokenTypestring
- The token's type, such as "access_token" or "id_token", set in the typ claim. 
- claimsIEnumerable<Claim>
- A collection of additional claims to include in the token.