TokenProvider Class
- java.
lang. Object - com.
microsoft. azure. servicebus. security. TokenProvider
- com.
public abstract class TokenProvider
This abstract class defines the contract of a token provider. All token providers should inherit from this class. An instance of token provider is used to obtain a security token for a given audience.
Constructor Summary
Constructor | Description | |
---|---|---|
TokenProvider() |
Method Summary
Modifier and Type | Method and Description |
---|---|
static
Token |
createAzureActiveDirectoryTokenProvider(AzureActiveDirectoryTokenProvider.AuthenticationCallback callback, String authority, Object callbackState)
Creates a Azure Active Directory token provider that creates a token with the user defined Authentication |
static
Token |
createManagedIdentityTokenProvider()
Creates a Managed Identity token provider. |
static
Token |
createSharedAccessSignatureTokenProvider(String sasKeyName, String sasKey)
Creates a Shared Access Signature token provider with the given key name and key value. |
static
Token |
createSharedAccessSignatureTokenProvider(String sasToken, Instant sasTokenValidUntil)
Creates a Shared Access Signature token provider that always returns an already created token. |
abstract
Completable |
getSecurityTokenAsync(String audience)
Asynchronously gets a security token for the given audience. |
Methods inherited from java.lang.Object
Constructor Details
TokenProvider
public TokenProvider()
Method Details
createAzureActiveDirectoryTokenProvider
public 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. This is a utility method.
Parameters:
Returns:
createManagedIdentityTokenProvider
public static TokenProvider createManagedIdentityTokenProvider()
Creates a Managed Identity token provider. This is a utility method.
Returns:
createSharedAccessSignatureTokenProvider
public static TokenProvider createSharedAccessSignatureTokenProvider(String sasKeyName, String sasKey)
Creates a Shared Access Signature token provider with the given key name and key value. Returned token provider creates tokens with validity of 20 minutes. This is a utility method.
Parameters:
Returns:
createSharedAccessSignatureTokenProvider
public static TokenProvider createSharedAccessSignatureTokenProvider(String sasToken, Instant sasTokenValidUntil)
Creates a Shared Access Signature token provider that always returns an already created token. This is a utility method.
Parameters:
Returns:
getSecurityTokenAsync
public abstract CompletableFuture
Asynchronously gets a security token for the given audience. Implementations of this method may choose to create a new token for every call or return a cached token. But the token returned must be valid.
Parameters:
Returns:
Applies to
Azure SDK for Java