TokenProvider (Azure SDK for Java Reference Documentation)
Constructor Summary
Constructor Detail
TokenProvider
public TokenProvider()
Method Detail
getSecurityTokenAsync
public abstract CompletableFuture<SecurityToken> getSecurityTokenAsync(String audience)
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:audience
- path of the entity for which this security token is to be presented Returns: an instance of CompletableFuture which returns aSecurityToken
on completion.
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:sasKeyName
- SAS key namesasKey
- SAS key value Returns: an instance of Shared Access Signature token provider with the given key name, key value.
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:sasToken
- Already created Shared Access Signature token to be returned bygetSecurityTokenAsync(String)
method.sasTokenValidUntil
- Instant when the token expires Returns: an instance of Shared Access Signature token provider that always returns an already created token.
createAzureActiveDirectoryTokenProvider
public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String userName, String password) throws MalformedURLException
Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId, username and password. This is a utility method.
Parameters:authorityUrl
- URL of the Azure Active Directory instanceclientId
- client id of the applicationuserName
- user namepassword
- password Returns: an instance of Azure Active Directory token provider Throws:MalformedURLException
- if the authority URL is not well formed
createAzureActiveDirectoryTokenProvider
public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String clientSecret) throws MalformedURLException
Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId and client secret. This is a utility method.
Parameters:authorityUrl
- URL of the Azure Active Directory instanceclientId
- client id of the applicationclientSecret
- client secret of the application Returns: an instance of Azure Active Directory token provider Throws:MalformedURLException
- if the authority URL is not well formed
createManagedServiceIdentityTokenProvider
public static TokenProvider createManagedServiceIdentityTokenProvider()
Creates a Managed Service Identity token provider. This is a utility method.
Returns: an instance of Managed Service Identity token provider
Copyright © 2019 Microsoft Corporation. All rights reserved.
ncG1vNJzZmiZqqq%2Fpr%2FDpJirrJmbrqTA0meZpaeSY7CwvsRnrqKmlKTEtHrNnqtomaqqv6Z50p2iZp6fp3qrrdWaZqyskZy2r7OOmqeinJ%2BYwHCvzqZmpqGTp7y0u8WtZpqypaeycL%2FEq62im5WXwrR70p6arqqZqcZwoM6knKeIoqTDqrDEq2WhrJ2h