public abstract class TokenProvider extends Object
Constructor and Description |
---|
TokenProvider() |
Modifier and Type | Method and Description |
---|---|
static TokenProvider |
createAzureActiveDirectoryTokenProvider(AzureActiveDirectoryTokenProvider.AuthenticationCallback callback,
String authority,
Object callbackState)
Creates a Azure Active Directory token provider that creates a token with the user defined AuthenticationCallback.
|
static TokenProvider |
createManagedIdentityTokenProvider()
Creates a Managed Identity token provider.
|
static TokenProvider |
createSharedAccessSignatureTokenProvider(String sasToken,
Instant sasTokenValidUntil)
Creates a Shared Access Signature token provider that always returns an already created token.
|
static TokenProvider |
createSharedAccessSignatureTokenProvider(String sasKeyName,
String sasKey)
Creates a Shared Access Signature token provider with the given key name and key value.
|
abstract CompletableFuture<SecurityToken> |
getSecurityTokenAsync(String audience)
Asynchronously gets a security token for the given audience.
|
public abstract CompletableFuture<SecurityToken> getSecurityTokenAsync(String audience)
audience
- path of the entity for which this security token is to be presentedSecurityToken
on completion.public static TokenProvider createSharedAccessSignatureTokenProvider(String sasKeyName, String sasKey)
sasKeyName
- SAS key namesasKey
- SAS key valuepublic static TokenProvider createSharedAccessSignatureTokenProvider(String sasToken, Instant sasTokenValidUntil)
sasToken
- Already created Shared Access Signature token to be returned by getSecurityTokenAsync(String)
method.sasTokenValidUntil
- Instant when the token expirespublic static TokenProvider createAzureActiveDirectoryTokenProvider(AzureActiveDirectoryTokenProvider.AuthenticationCallback callback, String authority, Object callbackState)
callback
- A custom AuthenticationCallback that takes in the target resource and address of the authority
to issue token and provides a security token for the target urlauthority
- URL of the Azure Active Directory instancecallbackState
- Custom parameter that may be provided to the AuthenticationCallbackpublic static TokenProvider createManagedIdentityTokenProvider()
Copyright © 2019 Microsoft Corporation. All rights reserved.