Class TokenExchanger
- Namespace
- Steeltoe.Security.Authentication.CloudFoundry
- Assembly
- Steeltoe.Security.Authentication.CloudFoundryBase.dll
public class TokenExchanger
- Inheritance
-
TokenExchanger
- Inherited Members
Constructors
TokenExchanger(AuthServerOptions, HttpClient, ILogger)
public TokenExchanger(AuthServerOptions options, HttpClient httpclient = null, ILogger logger = null)
Parameters
options
AuthServerOptionshttpclient
HttpClientlogger
ILogger
Methods
ExchangeAuthCodeForClaimsIdentity(string)
Passes an authorization code to OAuth server, maps server's OpenIdTokenResponse mapped to ClaimsIdentity
public Task<ClaimsIdentity> ExchangeAuthCodeForClaimsIdentity(string code)
Parameters
code
stringAuth code received after user logs in at remote server
Returns
- Task<ClaimsIdentity>
The user's ClaimsIdentity
ExchangeCodeForToken(string, string, CancellationToken)
Perform the HTTP call to exchange an authorization code for a token
public Task<HttpResponseMessage> ExchangeCodeForToken(string code, string targetUrl, CancellationToken cancellationToken)
Parameters
code
stringThe auth code to exchange
targetUrl
stringThe full address of the token endpoint
cancellationToken
CancellationTokenYour CancellationToken
Returns
- Task<HttpResponseMessage>
The response from the remote server
GetAccessTokenWithClientCredentials(string)
Get an access token using client_credentials grant
public Task<HttpResponseMessage> GetAccessTokenWithClientCredentials(string targetUrl)
Parameters
targetUrl
stringfull address of the token endpoint at the auth server
Returns
- Task<HttpResponseMessage>
HttpResponse from the auth server