Package com.azure.core.credential
Class AzureSasCredential
java.lang.Object
com.azure.core.credential.AzureSasCredential
Represents a credential that uses a shared access signature to authenticate to an Azure Service.
-
Constructor Summary
ConstructorDescriptionAzureSasCredential
(String signature) Creates a credential that authorizes request with the given shared access signature.AzureSasCredential
(String signature, Function<String, String> signatureEncoder) Creates a credential that authorizes request within the given shared access signature. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the shared access signature associated to this credential.Rotates the shared access signature associated to this credential.
-
Constructor Details
-
AzureSasCredential
Creates a credential that authorizes request with the given shared access signature.The
signature
passed is assumed to be encoded. This constructor is effectively the same as callingnew AzureSasCredential(signature, null))
.- Parameters:
signature
- The shared access signature used to authorize requests.- Throws:
NullPointerException
- Ifsignature
isnull
.IllegalArgumentException
- Ifsignature
is an empty string.
-
AzureSasCredential
Creates a credential that authorizes request within the given shared access signature.If
signatureEncoder
is non-null thesignature
, and allupdated signatures
, will be encoded using the function.signatureEncoder
should be as idempotent as possible to reduce the chance of double encoding errors.- Parameters:
signature
- The shared access signature used to authorize requests.signatureEncoder
- An optional function which encodes thesignature
.- Throws:
NullPointerException
- Ifsignature
isnull
.IllegalArgumentException
- Ifsignature
is an empty string.
-
-
Method Details
-
getSignature
Retrieves the shared access signature associated to this credential.- Returns:
- The shared access signature being used to authorize requests.
-
update
Rotates the shared access signature associated to this credential.- Parameters:
signature
- The new shared access signature to be associated with this credential.- Returns:
- The updated
AzureSasCredential
object. - Throws:
NullPointerException
- Ifsignature
isnull
.IllegalArgumentException
- Ifsignature
is an empty string.
-