TokenCredentials Class

  • java.lang.Object
    • com.microsoft.bot.restclient.credentials.TokenCredentials

Implements

public class TokenCredentials
implements ServiceClientCredentials

Token based credentials for use with a REST Service Client.

Constructor Summary

Constructor Description
TokenCredentials(String withScheme, String withToken)

Initializes a new instance of the TokenCredentials.

Method Summary

Modifier and Type Method and Description
void applyCredentialsFilter(OkHttpClient.Builder clientBuilder)

Apply the credentials to the HTTP client builder.

protected java.lang.String getScheme()

Get the authentication scheme.

protected java.lang.String getToken(Request request)

Get the secure token.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

TokenCredentials

public TokenCredentials(String withScheme, String withToken)

Initializes a new instance of the TokenCredentials.

Parameters:

withScheme - scheme to use. If null, defaults to Bearer
withToken - valid token

Method Details

applyCredentialsFilter

public void applyCredentialsFilter(OkHttpClient.Builder clientBuilder)

Apply the credentials to the HTTP client builder.

Parameters:

clientBuilder

getScheme

protected String getScheme()

Get the authentication scheme.

Returns:

the authentication scheme

getToken

protected String getToken(Request request)

Get the secure token. Override this method to provide a mechanism for acquiring tokens.

Parameters:

request - the context of the HTTP request

Returns:

the secure token.

Applies to