Table of Contents

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 AuthServerOptions
httpclient HttpClient
logger 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 string

Auth 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 string

The auth code to exchange

targetUrl string

The full address of the token endpoint

cancellationToken CancellationToken

Your 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 string

full address of the token endpoint at the auth server

Returns

Task<HttpResponseMessage>

HttpResponse from the auth server