Package com.microsoft.rest.credentials
Class TokenCredentials
- java.lang.Object
-
- com.microsoft.rest.credentials.TokenCredentials
-
- All Implemented Interfaces:
ServiceClientCredentials
public class TokenCredentials extends Object implements ServiceClientCredentials
Token based credentials for use with a REST Service Client.
-
-
Constructor Summary
Constructors Constructor Description TokenCredentials(String scheme, String token)Initializes a new instance of the TokenCredentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyCredentialsFilter(okhttp3.OkHttpClient.Builder clientBuilder)Apply the credentials to the HTTP client builder.protected StringgetScheme()Get the authentication scheme.protected StringgetToken(okhttp3.Request request)Get the secure token.
-
-
-
Method Detail
-
getToken
protected String getToken(okhttp3.Request request) throws IOException
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.
- Throws:
IOException- exception thrown from token acquisition operations.
-
getScheme
protected String getScheme()
Get the authentication scheme.- Returns:
- the authentication scheme
-
applyCredentialsFilter
public void applyCredentialsFilter(okhttp3.OkHttpClient.Builder clientBuilder)
Description copied from interface:ServiceClientCredentialsApply the credentials to the HTTP client builder.- Specified by:
applyCredentialsFilterin interfaceServiceClientCredentials- Parameters:
clientBuilder- the builder for building up anOkHttpClient
-
-