Class 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 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 key
        sasKey - SAS key
        tokenValidityInSeconds - 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 generated
        sasTokenValidUntil - 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 class TokenProvider
        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.