addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_PERMISSIONS, permissions); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_START, startString); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_EXPIRY, stopString); addIfNotNullOrEmpty(builder, Constants.QueryConstants.START_PARTITION_KEY, startPartitionKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.START_ROW_KEY, startRowKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.END_PARTITION_KEY, endPartitionKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.END_ROW_KEY, endRowKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_IDENTIFIER, accessPolicyIdentifier); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_RESOURCE, resourceType); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_IP, ipRange != null ? ipRange.toString() : null); addIfNotNullOrEmpty( builder, Constants.QueryConstants.SIGNED_PROTOCOLS, protocols != null ? protocols.toString() : null); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SAS_TABLE_NAME, tableName); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CACHE_CONTROL, headers.getCacheControl()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_TYPE, headers.getContentType()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_ENCODING, headers.getContentEncoding()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_LANGUAGE, headers.getContentLanguage()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_DISPOSITION, headers.getContentDisposition()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNATURE, signature);
/** * Get the signature hash embedded inside the Shared Access Signature for queue service. * * @param policy * The shared access policy to hash. * @param accessPolicyIdentifier * An optional identifier for the policy. * @param resourceName * The resource name. * @param ipRange * The range of IP addresses to hash. * @param protocols * The Internet protocols to hash. * @param client * The ServiceClient associated with the object. * * @return The signature hash embedded inside the Shared Access Signature. * @throws InvalidKeyException * @throws StorageException */ public static String generateSharedAccessSignatureHashForQueue( final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client) throws InvalidKeyException, StorageException { final String stringToSign = generateSharedAccessSignatureStringToSign( policy, resourceName, ipRange, protocols, accessPolicyIdentifier); return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials()); }
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile( final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(policy, null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", ipRange, protocols, signature);
/** * Returns a shared access signature for the account. * * @param policy * A {@link SharedAccessAccountPolicy} specifying the access policy for the shared access signature. * * @return The query string returned includes the leading question mark. * @throws StorageException * If a storage service error occurred. * @throws InvalidKeyException * If the key is invalid. */ public String generateSharedAccessSignature(SharedAccessAccountPolicy policy) throws InvalidKeyException, StorageException { if (!StorageCredentialsHelper.canCredentialsSignRequest(this.getCredentials())) { throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY); } final String sig = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForAccount( this.credentials.getAccountName(), policy, this.getCredentials()); final UriQueryBuilder sasBuilder = SharedAccessSignatureHelper.generateSharedAccessSignatureForAccount(policy, sig); return sasBuilder.toString(); }
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue( policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient); final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue( policy, groupPolicyIdentifier, ipRange, protocols, signature);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForTable( policy, accessPolicyIdentifier, resourceName, ipRange, protocols, startPartitionKey, startRowKey, endPartitionKey, endRowKey, this.tableServiceClient); final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForTable( policy, startPartitionKey, startRowKey, endPartitionKey, endRowKey, accessPolicyIdentifier, ipRange, protocols, this.name, signature);
Constants.HeaderConstants.TARGET_STORAGE_VERSION); return generateSharedAccessSignatureHashHelper(stringToSign, creds);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile( final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile( policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);
/** * Returns a shared access signature for the account. * * @param policy * A {@link SharedAccessAccountPolicy} specifying the access policy for the shared access signature. * * @return The query string returned includes the leading question mark. * @throws StorageException * If a storage service error occurred. * @throws InvalidKeyException * If the key is invalid. */ public String generateSharedAccessSignature(SharedAccessAccountPolicy policy) throws InvalidKeyException, StorageException { if (!StorageCredentialsHelper.canCredentialsSignRequest(this.getCredentials())) { throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY); } final String sig = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForAccount( this.credentials.getAccountName(), policy, this.getCredentials()); final UriQueryBuilder sasBuilder = SharedAccessSignatureHelper.generateSharedAccessSignatureForAccount(policy, sig); return sasBuilder.toString(); }
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue( policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient); final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue( policy, groupPolicyIdentifier, ipRange, protocols, signature);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForTable( policy, accessPolicyIdentifier, resourceName, ipRange, protocols, startPartitionKey, startRowKey, endPartitionKey, endRowKey, this.tableServiceClient); final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForTable( policy, startPartitionKey, startRowKey, endPartitionKey, endRowKey, accessPolicyIdentifier, ipRange, protocols, this.name, signature);
Constants.HeaderConstants.TARGET_STORAGE_VERSION); return generateSharedAccessSignatureHashHelper(stringToSign, creds);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile( final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(policy, null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", ipRange, protocols, signature);
/** * Get the signature hash embedded inside the Shared Access Signature for queue service. * * @param policy * The shared access policy to hash. * @param accessPolicyIdentifier * An optional identifier for the policy. * @param resourceName * The resource name. * @param ipRange * The range of IP addresses to hash. * @param protocols * The Internet protocols to hash. * @param client * The ServiceClient associated with the object. * * @return The signature hash embedded inside the Shared Access Signature. * @throws InvalidKeyException * @throws StorageException */ public static String generateSharedAccessSignatureHashForQueue( final SharedAccessQueuePolicy policy, final String accessPolicyIdentifier, final String resourceName, final IPRange ipRange, final SharedAccessProtocols protocols, final ServiceClient client) throws InvalidKeyException, StorageException { final String stringToSign = generateSharedAccessSignatureStringToSign( policy, resourceName, ipRange, protocols, accessPolicyIdentifier); return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials()); }
addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_PERMISSIONS, permissions); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_START, startString); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_EXPIRY, stopString); addIfNotNullOrEmpty(builder, Constants.QueryConstants.START_PARTITION_KEY, startPartitionKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.START_ROW_KEY, startRowKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.END_PARTITION_KEY, endPartitionKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.END_ROW_KEY, endRowKey); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_IDENTIFIER, accessPolicyIdentifier); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_RESOURCE, resourceType); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNED_IP, ipRange != null ? ipRange.toString() : null); addIfNotNullOrEmpty( builder, Constants.QueryConstants.SIGNED_PROTOCOLS, protocols != null ? protocols.toString() : null); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SAS_TABLE_NAME, tableName); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CACHE_CONTROL, headers.getCacheControl()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_TYPE, headers.getContentType()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_ENCODING, headers.getContentEncoding()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_LANGUAGE, headers.getContentLanguage()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.CONTENT_DISPOSITION, headers.getContentDisposition()); addIfNotNullOrEmpty(builder, Constants.QueryConstants.SIGNATURE, signature);
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile( final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile( policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);
throws InvalidKeyException, StorageException { String stringToSign = generateSharedAccessSignatureStringToSign( policy, resourceName, ipRange, protocols, accessPolicyIdentifier); endRowKey == null ? Constants.EMPTY_STRING : endRowKey); return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());
addIfNotNullOrEmpty(builder, entry.getKey().toLowerCase(), values.toString());
final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile( policy, headers, groupPolicyIdentifier, this.getCanonicalName(), ipRange, protocols, this.fileServiceClient); final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile( policy, headers, groupPolicyIdentifier, "f", ipRange, protocols, signature);
throws InvalidKeyException, StorageException { String stringToSign = generateSharedAccessSignatureStringToSign( policy, resourceName, ipRange, protocols, accessPolicyIdentifier); endRowKey == null ? Constants.EMPTY_STRING : endRowKey); return generateSharedAccessSignatureHashHelper(stringToSign, client.getCredentials());