Class TokenExchanger
Inheritance
System.Object
TokenExchanger
Namespace: Steeltoe.Security.Authentication.CloudFoundry
Assembly: Steeltoe.Security.Authentication.CloudFoundryBase.dll
Syntax
public class TokenExchanger : object
Constructors
| Edit this page View SourceTokenExchanger(AuthServerOptions, HttpClient, ILogger)
Declaration
public TokenExchanger(AuthServerOptions options, HttpClient httpclient = null, ILogger logger = null)
Parameters
Type | Name | Description |
---|---|---|
AuthServerOptions | options | |
HttpClient | httpclient | |
ILogger | logger |
Methods
| Edit this page View SourceExchangeAuthCodeForClaimsIdentity(String)
Passes an authorization code to OAuth server, maps server's OpenIdTokenResponse mapped to
Declaration
public async Task<ClaimsIdentity> ExchangeAuthCodeForClaimsIdentity(string code)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | Auth code received after user logs in at remote server |
Returns
Type | Description |
---|---|
Task<ClaimsIdentity> | The user's ClaimsIdentity |
ExchangeCodeForToken(String, String, CancellationToken)
Perform the HTTP call to exchange an authorization code for a token
Declaration
public async Task<HttpResponseMessage> ExchangeCodeForToken(string code, string targetUrl, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.String | code | The auth code to exchange |
System.String | targetUrl | The full address of the token endpoint |
CancellationToken | cancellationToken | Your CancellationToken |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> | The response from the remote server |
GetAccessTokenWithClientCredentials(String)
Get an access token using client_credentials grant
Declaration
public async Task<HttpResponseMessage> GetAccessTokenWithClientCredentials(string targetUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | targetUrl | full address of the token endpoint at the auth server |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> | HttpResponse from the auth server |