Class SharedAccessSignatureTokenProvider
- java.lang.Object
-
- com.microsoft.azure.servicebus.security.TokenProvider
-
- com.microsoft.azure.servicebus.security.SharedAccessSignatureTokenProvider
-
public class SharedAccessSignatureTokenProvider extends TokenProvider
This is a token provider that generates Shared Access Signature(SAS) tokens or reuses an already generated SAS token.- Since:
- 1.2.0
-
-
Constructor Summary
Constructors Constructor Description SharedAccessSignatureTokenProvider(String sasKeyName, String sasKey, int tokenValidityInSeconds)
Creates an instance that generates SAS tokens from the given SAS key name and value.SharedAccessSignatureTokenProvider(String sasToken, Instant sasTokenValidUntil)
Creates an instance that doesn't generate tokens but reuses an already generated SAS token.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<SecurityToken>
getSecurityTokenAsync(String audience)
Asynchronously gets a security token for the given audience.-
Methods inherited from class com.microsoft.azure.servicebus.security.TokenProvider
createAzureActiveDirectoryTokenProvider, createManagedIdentityTokenProvider, createSharedAccessSignatureTokenProvider, createSharedAccessSignatureTokenProvider
-
-
-
-
Constructor Detail
-
SharedAccessSignatureTokenProvider
public SharedAccessSignatureTokenProvider(String sasKeyName, String sasKey, int tokenValidityInSeconds)
Creates an instance that generates SAS tokens from the given SAS key name and value.- Parameters:
sasKeyName
- name of the SAS keysasKey
- SAS keytokenValidityInSeconds
- validity of the token to be generated
-
SharedAccessSignatureTokenProvider
public SharedAccessSignatureTokenProvider(String sasToken, Instant sasTokenValidUntil)
Creates an instance that doesn't generate tokens but reuses an already generated SAS token.- Parameters:
sasToken
- SAS token already generatedsasTokenValidUntil
- Instant when the SAS token expires.
-
-
Method Detail
-
getSecurityTokenAsync
public CompletableFuture<SecurityToken> getSecurityTokenAsync(String audience)
Description copied from class:TokenProvider
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.- Specified by:
getSecurityTokenAsync
in classTokenProvider
- Parameters:
audience
- path of the entity for which this security token is to be presented- Returns:
- an instance of CompletableFuture which returns a
SecurityToken
on completion.
-
-