public class SharedAccessSignatureHelper extends Object
Modifier and Type | Method and Description |
---|---|
static UriQueryBuilder |
generateSharedAccessSignatureForAccount(SharedAccessAccountPolicy policy,
String signature)
Get the signature hash embedded inside the Shared Access Signature for a
CloudStorageAccount . |
static UriQueryBuilder |
generateSharedAccessSignatureForBlobAndFile(SharedAccessPolicy policy,
SharedAccessHeaders headers,
String groupPolicyIdentifier,
String resourceType,
IPRange ipRange,
SharedAccessProtocols protocols,
String signature)
Get the complete query builder for creating the Shared Access Signature query.
|
static UriQueryBuilder |
generateSharedAccessSignatureForQueue(SharedAccessQueuePolicy policy,
String groupPolicyIdentifier,
IPRange ipRange,
SharedAccessProtocols protocols,
String signature)
Get the complete query builder for creating the Shared Access Signature query.
|
static UriQueryBuilder |
generateSharedAccessSignatureForTable(SharedAccessTablePolicy policy,
String startPartitionKey,
String startRowKey,
String endPartitionKey,
String endRowKey,
String accessPolicyIdentifier,
IPRange ipRange,
SharedAccessProtocols protocols,
String tableName,
String signature)
Get the complete query builder for creating the Shared Access Signature query.
|
static String |
generateSharedAccessSignatureHashForAccount(String accountName,
SharedAccessAccountPolicy policy,
StorageCredentials creds)
Get the signature hash embedded inside the Shared Access Signature for a
CloudStorageAccount . |
static String |
generateSharedAccessSignatureHashForBlobAndFile(SharedAccessPolicy policy,
SharedAccessHeaders headers,
String accessPolicyIdentifier,
String resourceName,
IPRange ipRange,
SharedAccessProtocols protocols,
ServiceClient client)
Get the signature hash embedded inside the Shared Access Signature for the blob or file service.
|
static String |
generateSharedAccessSignatureHashForQueue(SharedAccessQueuePolicy policy,
String accessPolicyIdentifier,
String resourceName,
IPRange ipRange,
SharedAccessProtocols protocols,
ServiceClient client)
Get the signature hash embedded inside the Shared Access Signature for queue service.
|
static String |
generateSharedAccessSignatureHashForTable(SharedAccessTablePolicy policy,
String accessPolicyIdentifier,
String resourceName,
IPRange ipRange,
SharedAccessProtocols protocols,
String startPartitionKey,
String startRowKey,
String endPartitionKey,
String endRowKey,
ServiceClient client)
Get the signature hash embedded inside the Shared Access Signature for the table service.
|
static StorageCredentialsSharedAccessSignature |
parseQuery(HashMap<String,String[]> queryParams)
Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.
|
static StorageCredentialsSharedAccessSignature |
parseQuery(StorageUri completeUri)
Parses the query parameters and populates a StorageCredentialsSharedAccessSignature object if one is present.
|
public static UriQueryBuilder generateSharedAccessSignatureForAccount(SharedAccessAccountPolicy policy, String signature) throws StorageException
CloudStorageAccount
.policy
- The shared access policy to hash.ipRange
- An optional range of IP addresses.protocols
- An optional restriction of allowed protocols.signature
- The signature to use.InvalidKeyException
StorageException
public static UriQueryBuilder generateSharedAccessSignatureForBlobAndFile(SharedAccessPolicy policy, SharedAccessHeaders headers, String groupPolicyIdentifier, String resourceType, IPRange ipRange, SharedAccessProtocols protocols, String signature) throws StorageException
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.IllegalArgumentException
StorageException
public static UriQueryBuilder generateSharedAccessSignatureForQueue(SharedAccessQueuePolicy policy, String groupPolicyIdentifier, IPRange ipRange, SharedAccessProtocols protocols, String signature) throws StorageException
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.IllegalArgumentException
StorageException
public static UriQueryBuilder generateSharedAccessSignatureForTable(SharedAccessTablePolicy policy, String startPartitionKey, String startRowKey, String endPartitionKey, String endRowKey, String accessPolicyIdentifier, IPRange ipRange, SharedAccessProtocols protocols, String tableName, String signature) throws StorageException
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.IllegalArgumentException
StorageException
public static String generateSharedAccessSignatureHashForAccount(String accountName, SharedAccessAccountPolicy policy, StorageCredentials creds) throws InvalidKeyException, StorageException
CloudStorageAccount
.accountName
- The name of the account to use for the SAS.policy
- The shared access policy to hash.ipRange
- An optional range of IP addresses.protocols
- An optional restriction of allowed protocols.creds
- The StorageCredentials
associated with the object.InvalidKeyException
StorageException
public static String generateSharedAccessSignatureHashForBlobAndFile(SharedAccessPolicy policy, SharedAccessHeaders headers, String accessPolicyIdentifier, String resourceName, IPRange ipRange, SharedAccessProtocols protocols, ServiceClient client) throws InvalidKeyException, StorageException
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.InvalidKeyException
StorageException
public static String generateSharedAccessSignatureHashForQueue(SharedAccessQueuePolicy policy, String accessPolicyIdentifier, String resourceName, IPRange ipRange, SharedAccessProtocols protocols, ServiceClient client) throws InvalidKeyException, StorageException
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.InvalidKeyException
StorageException
public static String generateSharedAccessSignatureHashForTable(SharedAccessTablePolicy policy, String accessPolicyIdentifier, String resourceName, IPRange ipRange, SharedAccessProtocols protocols, String startPartitionKey, String startRowKey, String endPartitionKey, String endRowKey, ServiceClient client) throws InvalidKeyException, StorageException
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.InvalidKeyException
StorageException
public static StorageCredentialsSharedAccessSignature parseQuery(StorageUri completeUri) throws StorageException
completeUri
- A StorageUri
object which represents the complete Uri.StorageException
- An exception representing any error which occurred during the operation.public static StorageCredentialsSharedAccessSignature parseQuery(HashMap<String,String[]> queryParams) throws StorageException
queryParams
- The parameters to parse.StorageException
- An exception representing any error which occurred during the operation.Copyright © 2019. All rights reserved.