SharedAccessSignatureHelper Class

  • java.lang.Object
    • com.microsoft.azure.storage.core.SharedAccessSignatureHelper

public class SharedAccessSignatureHelper

RESERVED FOR INTERNAL USE. Contains helper methods for implementing shared access signatures.

Method Summary

Modifier and Type Method and Description
UriQueryBuilder generateSharedAccessSignatureForAccount(final SharedAccessAccountPolicy policy, final String signature)

Get the signature hash embedded inside the Shared Access Signature for a CloudStorageAccount.

UriQueryBuilder generateSharedAccessSignatureForBlobAndFile(final SharedAccessPolicy policy, final SharedAccessHeaders headers, final String groupPolicyIdentifier, final String resourceType, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

UriQueryBuilder generateSharedAccessSignatureForQueue(final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

UriQueryBuilder generateSharedAccessSignatureForTable(final SharedAccessTablePolicy policy, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final String accessPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, final String tableName, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

String generateSharedAccessSignatureHashForAccount(final String accountName, final SharedAccessAccountPolicy policy, final StorageCredentials creds)

Get the signature hash embedded inside the Shared Access Signature for a CloudStorageAccount.

String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy, SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client, final String service, final String snapshotId)

Get the signature hash embedded inside the Shared Access Signature for the blob or file service.

String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy, SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client, final String service, final String snapshotId, boolean skipDecoding)

Get the signature hash embedded inside the Shared Access Signature for the blob or file service.

String generateSharedAccessSignatureHashForQueue(final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)

Get the signature hash embedded inside the Shared Access Signature for queue service.

String generateSharedAccessSignatureHashForTable(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client)

Get the signature hash embedded inside the Shared Access Signature for the table service.

UriQueryBuilder generateUserDelegationSharedAccessSignatureForBlob(final SharedAccessPolicy policy, final SharedAccessHeaders headers, final String resourceType, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature, final UserDelegationKey delegationKey)

Get the complete query builder for creating the Shared Access Signature query.

String generateUserDelegationSharedAccessSignatureHashForBlob(final SharedAccessBlobPolicy policy, SharedAccessBlobHeaders headers, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final UserDelegationKey delegationKey)

Get the signature hash embedded inside the user delegation Shared Access Signature for the blob service.

StorageCredentialsSharedAccessSignature parseQuery(final HashMap<String, String[]> queryParams)

Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.

StorageCredentialsSharedAccessSignature parseQuery(final StorageUri completeUri)

Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.

Method Details

generateSharedAccessSignatureForAccount

public static UriQueryBuilder generateSharedAccessSignatureForAccount(final SharedAccessAccountPolicy policy, final String signature)

Get the signature hash embedded inside the Shared Access Signature for a CloudStorageAccount.

Parameters:

policy - The shared access policy to hash.
signature - The signature to use.

Returns:

The finished query builder

Throws:

StorageException

generateSharedAccessSignatureForBlobAndFile

public static UriQueryBuilder generateSharedAccessSignatureForBlobAndFile(final SharedAccessPolicy policy, final SharedAccessHeaders headers, final String groupPolicyIdentifier, final String resourceType, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

Parameters:

policy - The shared access policy for the shared access signature.
headers - The optional header values to set for a blob or file accessed with this shared access signature.
groupPolicyIdentifier - An optional identifier for the policy.
resourceType - Either "b" for blobs, "c" for containers, "f" for files, or "s" for shares.
ipRange - The range of IP addresses for the shared access signature.
protocols - The Internet protocols for the shared access signature.
signature - The signature to use.

Returns:

The finished query builder

Throws:

IllegalArgumentException
StorageException

generateSharedAccessSignatureForQueue

public static UriQueryBuilder generateSharedAccessSignatureForQueue(final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

Parameters:

policy - The shared access policy for the shared access signature.
groupPolicyIdentifier - An optional identifier for the policy.
ipRange - The range of IP addresses for the shared access signature.
protocols - The Internet protocols for the shared access signature.
signature - The signature to use.

Returns:

The finished query builder

Throws:

IllegalArgumentException
StorageException

generateSharedAccessSignatureForTable

public static UriQueryBuilder generateSharedAccessSignatureForTable(final SharedAccessTablePolicy policy, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final String accessPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols, final String tableName, final String signature)

Get the complete query builder for creating the Shared Access Signature query.

Parameters:

policy - The shared access policy for the shared access signature.
startPartitionKey - An optional restriction of the beginning of the range of partition keys to include.
startRowKey - An optional restriction of the beginning of the range of row keys to include.
endPartitionKey - An optional restriction of the end of the range of partition keys to include.
endRowKey - An optional restriction of the end of the range of row keys to include.
accessPolicyIdentifier - An optional identifier for the policy.
ipRange - The range of IP addresses for the shared access signature.
protocols - The Internet protocols for the shared access signature.
tableName - The table name.
signature - The signature to use.

Returns:

The finished query builder

Throws:

IllegalArgumentException
StorageException

generateSharedAccessSignatureHashForAccount

public static String generateSharedAccessSignatureHashForAccount(final String accountName, final SharedAccessAccountPolicy policy, final StorageCredentials creds)

Get the signature hash embedded inside the Shared Access Signature for a CloudStorageAccount.

Parameters:

accountName - The name of the account to use for the SAS.
policy - The shared access policy to hash.
creds - The StorageCredentials associated with the object.

Returns:

The signature hash embedded inside the Shared Access Signature.

Throws:

InvalidKeyException
StorageException

generateSharedAccessSignatureHashForBlobAndFile

public static String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy, SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client, final String service, final String snapshotId)

Get the signature hash embedded inside the Shared Access Signature for the blob or file service.

Parameters:

policy - The shared access policy to hash.
headers - The optional header values to set for a blob or file accessed with this shared access signature.
accessPolicyIdentifier - An optional identifier for the policy.
resourceName - The resource name.
ipRange - The range of IP addresses to hash.
protocols - The Internet protocols to hash.
client - The ServiceClient associated with the object.
service
snapshotId

Returns:

The signature hash embedded inside the Shared Access Signature.

Throws:

InvalidKeyException
StorageException

generateSharedAccessSignatureHashForBlobAndFile

public static String generateSharedAccessSignatureHashForBlobAndFile(final SharedAccessPolicy policy, SharedAccessHeaders headers, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client, final String service, final String snapshotId, boolean skipDecoding)

Get the signature hash embedded inside the Shared Access Signature for the blob or file service.

Parameters:

policy - The shared access policy to hash.
headers - The optional header values to set for a blob or file accessed with this shared access signature.
accessPolicyIdentifier - An optional identifier for the policy.
resourceName - The resource name.
ipRange - The range of IP addresses to hash.
protocols - The Internet protocols to hash.
client - The ServiceClient associated with the object.
service
snapshotId
skipDecoding - Skip decoding the string to sign before signing.

Returns:

The signature hash embedded inside the Shared Access Signature.

Throws:

InvalidKeyException
StorageException

generateSharedAccessSignatureHashForQueue

public static String generateSharedAccessSignatureHashForQueue(final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client)

Get the signature hash embedded inside the Shared Access Signature for queue service.

Parameters:

policy - The shared access policy to hash.
accessPolicyIdentifier - An optional identifier for the policy.
resourceName - The resource name.
ipRange - The range of IP addresses to hash.
protocols - The Internet protocols to hash.
client - The ServiceClient associated with the object.

Returns:

The signature hash embedded inside the Shared Access Signature.

Throws:

InvalidKeyException
StorageException

generateSharedAccessSignatureHashForTable

public static String generateSharedAccessSignatureHashForTable(final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final String startPartitionKey, final String startRowKey, final String endPartitionKey, final String endRowKey, final ServiceClient client)

Get the signature hash embedded inside the Shared Access Signature for the table service.

Parameters:

policy - The shared access policy to hash.
accessPolicyIdentifier - An optional identifier for the policy.
resourceName - The resource name.
ipRange - The range of IP addresses to hash.
protocols - The Internet protocols to hash.
startPartitionKey - An optional restriction of the beginning of the range of partition keys to hash.
startRowKey - An optional restriction of the beginning of the range of row keys to hash.
endPartitionKey - An optional restriction of the end of the range of partition keys to hash.
endRowKey - An optional restriction of the end of the range of row keys to hash.
client - The ServiceClient associated with the object.

Returns:

The signature hash embedded inside the Shared Access Signature.

Throws:

InvalidKeyException
StorageException

generateUserDelegationSharedAccessSignatureForBlob

public static UriQueryBuilder generateUserDelegationSharedAccessSignatureForBlob(final SharedAccessPolicy policy, final SharedAccessHeaders headers, final String resourceType, final IPRange ipRange, final SharedAccessProtocols protocols, final String signature, final UserDelegationKey delegationKey)

Get the complete query builder for creating the Shared Access Signature query.

Parameters:

policy - The shared access policy for the shared access signature.
headers - The optional header values to set for a blob or file accessed with this shared access signature.
resourceType - Currently only "b" for blobs.
ipRange - The range of IP addresses for the shared access signature.
protocols - The Internet protocols for the shared access signature.
signature - The signature to use.
delegationKey - The key for constructing the token.

Returns:

The finished query builder.

Throws:

StorageException

generateUserDelegationSharedAccessSignatureHashForBlob

public static String generateUserDelegationSharedAccessSignatureHashForBlob(final SharedAccessBlobPolicy policy, SharedAccessBlobHeaders headers, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final UserDelegationKey delegationKey)

Get the signature hash embedded inside the user delegation Shared Access Signature for the blob service.

Parameters:

policy - The shared access policy to hash.
headers - The optional header values to set for a blob or file accessed with this shared access signature.
resourceName - The resource name.
ipRange - The range of IP addresses to hash.
protocols - The Internet protocols to hash.
delegationKey - The key data to sign and the secret to sign with.

Returns:

The signature hash to embed inside the Shared Access Signature.

parseQuery

public static StorageCredentialsSharedAccessSignature parseQuery(final HashMap queryParams)

Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.

Parameters:

queryParams - The parameters to parse.

Returns:

The StorageCredentialsSharedAccessSignature if one is present, otherwise null.

Throws:

StorageException - An exception representing any error which occurred during the operation.

parseQuery

public static StorageCredentialsSharedAccessSignature parseQuery(final StorageUri completeUri)

Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.

Parameters:

completeUri - A StorageUri object which represents the complete Uri.

Returns:

The StorageCredentialsSharedAccessSignature if one is present, otherwise null.

Throws:

StorageException - An exception representing any error which occurred during the operation.

Applies to