private static async Task CreateToken( HttpContext context, IdentityServerTokenRequest request, IdentityServerTools identityServerTools) { var token = await identityServerTools.IssueJwtAsync( lifetime : request.Lifetime, claims : request.Claims); var response = new IdentityServerTokenResponse { Token = token, }; await context.Response.WriteJsonAsync(response); }
private static async Task CreateClientToken( HttpContext context, IdentityServerClientTokenRequest request, IdentityServerTools identityServerTools) { var token = await identityServerTools.IssueClientJwtAsync( lifetime : request.Lifetime, clientId : request.ClientId, scopes : request.Scopes, audiences : request.Audiences); var response = new IdentityServerTokenResponse { Token = token, }; await context.Response.WriteJsonAsync(response); }