当前位置: 首页>>代码示例>>Java>>正文


Java StorageCredentialsHelper.canCredentialsSignRequest方法代码示例

本文整理汇总了Java中com.microsoft.azure.storage.core.StorageCredentialsHelper.canCredentialsSignRequest方法的典型用法代码示例。如果您正苦于以下问题:Java StorageCredentialsHelper.canCredentialsSignRequest方法的具体用法?Java StorageCredentialsHelper.canCredentialsSignRequest怎么用?Java StorageCredentialsHelper.canCredentialsSignRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.microsoft.azure.storage.core.StorageCredentialsHelper的用法示例。


在下文中一共展示了StorageCredentialsHelper.canCredentialsSignRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the container. Note this does not contain the leading "?".
 * 
 * @param policy
 *            An {@link SharedAccessBlobPolicy} object that represents the access policy for the shared access
 *            signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> which represents the container-level access policy.
 * 
 * @return A <code>String</code> which represents a shared access signature for the container.
 * 
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws InvalidKeyException
 *             If the key is invalid.
 */
public String generateSharedAccessSignature(final SharedAccessBlobPolicy policy, final String groupPolicyIdentifier)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlob(policy,
            null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, resourceName, this.blobServiceClient, null);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlob(policy,
            null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", signature);

    return builder.toString();
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:35,代码来源:CloudBlobContainer.java

示例2: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the queue.
 * 
 * @param policy
 *            The access policy for the shared access signature.
 * @param groupPolicyIdentifier
 *            A queue-level access policy.
 * @return A shared access signature for the queue.
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(policy,
            groupPolicyIdentifier, resourceName, this.queueServiceClient, null);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(policy,
            groupPolicyIdentifier, signature);

    return builder.toString();
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:34,代码来源:CloudQueue.java

示例3: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the share. Note this does not contain the leading "?".
 * 
 * @param policy
 *            An {@link SharedAccessFilePolicy} object that represents the access policy for the
 *            shared access signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> which represents the share-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 * 
 * @return A <code>String</code> which represents a shared access signature for the share.
 * 
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws InvalidKeyException
 *             If the key is invalid.
 */
public String generateSharedAccessSignature(
        final SharedAccessFilePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
        final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
            policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, resourceName,
            ipRange, protocols, this.fileServiceClient);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
            policy, null /* SharedAccessHeaders */, groupPolicyIdentifier, "s", ipRange, protocols, signature);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:42,代码来源:CloudFileShare.java

示例4: createCloudBlobClient

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a new Blob service client.
 * 
 * @return A {@link CloudBlobClient} that represents the cloud Blob client.
 * 
 */
public CloudBlobClient createCloudBlobClient() {
    if (this.getBlobStorageUri() == null) {
        throw new IllegalArgumentException(SR.BLOB_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.credentials)) {
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    return new CloudBlobClient(this.getBlobStorageUri(), this.getCredentials());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:21,代码来源:CloudStorageAccount.java

示例5: createCloudFileClient

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a new File service client.
 * 
 * @return A {@link CloudFileClient} that represents the cloud File client.
 * 
 */
public CloudFileClient createCloudFileClient() {
    if (this.getFileStorageUri() == null) {
        throw new IllegalArgumentException(SR.FILE_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.credentials)) {
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    return new CloudFileClient(this.getFileStorageUri(), this.getCredentials());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:21,代码来源:CloudStorageAccount.java

示例6: createCloudQueueClient

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a new Queue service client.
 * 
 * @return A client object that uses the Queue service endpoint.
 */
public CloudQueueClient createCloudQueueClient() {
    if (this.getQueueStorageUri() == null) {
        throw new IllegalArgumentException(SR.QUEUE_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.credentials)) {
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    return new CloudQueueClient(this.getQueueStorageUri(), this.getCredentials());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:20,代码来源:CloudStorageAccount.java

示例7: createCloudTableClient

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a new Table service client.
 * 
 * @return A client object that uses the Table service endpoint.
 */
public CloudTableClient createCloudTableClient() {
    if (this.getTableStorageUri() == null) {
        throw new IllegalArgumentException(SR.TABLE_ENDPOINT_NOT_CONFIGURED);
    }

    if (this.credentials == null) {
        throw new IllegalArgumentException(SR.MISSING_CREDENTIALS);
    }

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.credentials)) {
        throw new IllegalArgumentException(SR.CREDENTIALS_CANNOT_SIGN_REQUEST);
    }
    return new CloudTableClient(this.getTableStorageUri(), this.getCredentials());
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:20,代码来源:CloudStorageAccount.java

示例8: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a shared access signature for the table.
 *
 * @param policy
 *            A {@link SharedAccessTablePolicy} object which represents the access policy for the shared access
 *            signature.
 * @param accessPolicyIdentifier
 *            A <code>String</code> which represents a table-level access policy.
 * @param startPartitionKey
 *            A <code>String</code> which represents the starting partition key.
 * @param startRowKey
 *            A <code>String</code> which represents the starting row key.
 * @param endPartitionKey
 *            A <code>String</code> which represents the ending partition key.
 * @param endRowKey
 *            A <code>String</code> which represents the ending end key.
 *
 * @return A <code>String</code> containing the shared access signature for the table.
 *
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(final SharedAccessTablePolicy policy,
        final String accessPolicyIdentifier, final String startPartitionKey, final String startRowKey,
        final String endPartitionKey, final String endRowKey) throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.tableServiceClient.getCredentials())) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForTable(policy,
            accessPolicyIdentifier, resourceName, startPartitionKey, startRowKey, endPartitionKey, endRowKey,
            this.tableServiceClient, null);

    String accountKeyName = null;
    StorageCredentials credentials = this.tableServiceClient.getCredentials();

    if (credentials instanceof StorageCredentialsAccountAndKey) {
        accountKeyName = ((StorageCredentialsAccountAndKey) credentials).getAccountKeyName();
    }

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForTable(policy,
            startPartitionKey, startRowKey, endPartitionKey, endRowKey, accessPolicyIdentifier, this.name,
            signature, accountKeyName);

    return builder.toString();
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:54,代码来源:CloudTable.java

示例9: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:25,代码来源:CloudStorageAccount.java

示例10: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the blob using the specified group policy identifier and operation context.
 * Note this does not contain the leading "?".
 *
 * @param policy
 *            A <code>{@link SharedAccessPolicy}</code> object that represents the access policy for the shared
 *            access
 *            signature.
 * @param headers
 *            A <code>{@link SharedAccessBlobHeaders}</code> object that represents the optional header values to
 *            set for a blob accessed with this shared access signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> that represents the container-level access policy.
 *
 * @return A <code>String</code> that represents the shared access signature.
 *
 * @throws IllegalArgumentException
 *             If the credentials are invalid or the blob is a snapshot.
 * @throws InvalidKeyException
 *             If the credentials are invalid.
 * @throws StorageException
 *             If a storage service error occurred.
 */
public String generateSharedAccessSignature(final SharedAccessBlobPolicy policy,
        final SharedAccessBlobHeaders headers, final String groupPolicyIdentifier) throws InvalidKeyException,
        StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
    }

    if (this.isSnapshot()) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_FOR_SNAPSHOTS);
    }

    final String resourceName = this.getCanonicalName(true);

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlob(policy, headers,
            groupPolicyIdentifier, resourceName, this.blobServiceClient, null);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlob(policy,
            headers, groupPolicyIdentifier, "b", signature);

    return builder.toString();
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:46,代码来源:CloudBlob.java

示例11: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the container. Note this does not contain the leading "?".
 * 
 * @param policy
 *            An {@link SharedAccessBlobPolicy} object that represents the access policy for the shared access
 *            signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> which represents the container-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 * 
 * @return A <code>String</code> which represents a shared access signature for the container.
 * 
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws InvalidKeyException
 *             If the key is invalid.
 */
public String generateSharedAccessSignature(final SharedAccessBlobPolicy policy,
        final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {
    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }
    
    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
            policy, null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, resourceName,
            ipRange, protocols, this.blobServiceClient);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(policy,
            null /* SharedAccessBlobHeaders */, groupPolicyIdentifier, "c", ipRange, protocols, signature);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:40,代码来源:CloudBlobContainer.java

示例12: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the blob using the specified group policy identifier and operation context.
 * Note this does not contain the leading "?".
 *
 * @param policy
 *            A <code>{@link SharedAccessPolicy}</code> object that represents the access policy for the shared
 *            access signature.
 * @param headers
 *            A <code>{@link SharedAccessBlobHeaders}</code> object that represents the optional header values to
 *            set for a blob accessed with this shared access signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> that represents the container-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 *
 * @return A <code>String</code> that represents the shared access signature.
 *
 * @throws IllegalArgumentException
 *             If the credentials are invalid or the blob is a snapshot.
 * @throws InvalidKeyException
 *             If the credentials are invalid.
 * @throws StorageException
 *             If a storage service error occurred.
 */
public String generateSharedAccessSignature(
        final SharedAccessBlobPolicy policy, final SharedAccessBlobHeaders headers,
        final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {
    
    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.blobServiceClient.getCredentials())) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
    }
    
    if (this.isSnapshot()) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_FOR_SNAPSHOTS);
    }

    final String resourceName = this.getCanonicalName(true);

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile(
            policy, headers, groupPolicyIdentifier, resourceName, ipRange, protocols, this.blobServiceClient);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForBlobAndFile(
            policy, headers, groupPolicyIdentifier, "b", ipRange, protocols, signature);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:50,代码来源:CloudBlob.java

示例13: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the file using the specified group policy identifier and
 * shared access file headers. Note this does not contain the leading "?".
 *
 * @param policy
 *            A <code>{@link SharedAccessFilePolicy}</code> object that represents the access policy for the shared
 *            access signature.
 * @param headers
 *            A <code>{@link SharedAccessFileHeaders}</code> object that represents the optional header values to
 *            set for a file accessed with this shared access signature.
 * @param groupPolicyIdentifier
 *            A <code>String</code> that represents the share-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 *
 * @return A <code>String</code> that represents the shared access signature.
 *
 * @throws IllegalArgumentException
 *             If the credentials are invalid.
 * @throws InvalidKeyException
 *             If the credentials are invalid.
 * @throws StorageException
 *             If a storage service error occurred.
 */
public String generateSharedAccessSignature(
        final SharedAccessFilePolicy policy, final SharedAccessFileHeaders headers,
        final String groupPolicyIdentifier, final IPRange ipRange, final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.fileServiceClient.getCredentials())) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
    }

    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);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:45,代码来源:CloudFile.java

示例14: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Creates a shared access signature for the table.
 *
 * @param policy
 *            A {@link SharedAccessTablePolicy} object which represents the access policy for the shared access
 *            signature.
 * @param accessPolicyIdentifier
 *            A <code>String</code> which represents a table-level access policy.
 * @param startPartitionKey
 *            A <code>String</code> which represents the starting partition key.
 * @param startRowKey
 *            A <code>String</code> which represents the starting row key.
 * @param endPartitionKey
 *            A <code>String</code> which represents the ending partition key.
 * @param endRowKey
 *            A <code>String</code> which represents the ending end key.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 *
 * @return A <code>String</code> containing the shared access signature for the table.
 *
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(
        final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey,
        final String startRowKey, final String endPartitionKey, final String endRowKey, final IPRange ipRange,
        final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.tableServiceClient.getCredentials())) {
        throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    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);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:53,代码来源:CloudTable.java

示例15: generateSharedAccessSignature

import com.microsoft.azure.storage.core.StorageCredentialsHelper; //导入方法依赖的package包/类
/**
 * Returns a shared access signature for the queue.
 * 
 * @param policy
 *            The access policy for the shared access signature.
 * @param groupPolicyIdentifier
 *            A queue-level access policy.
 * @param ipRange
 *            A {@link IPRange} object containing the range of allowed IP addresses.
 * @param protocols
 *            A {@link SharedAccessProtocols} representing the allowed Internet protocols.
 *            
 * @return A shared access signature for the queue.
 * 
 * @throws InvalidKeyException
 *             If an invalid key was passed.
 * @throws StorageException
 *             If a storage service error occurred.
 * @throws IllegalArgumentException
 *             If an unexpected value is passed.
 */
public String generateSharedAccessSignature(
        final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
        final SharedAccessProtocols protocols)
        throws InvalidKeyException, StorageException {

    if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
        final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
        throw new IllegalArgumentException(errorMessage);
    }

    final String resourceName = this.getSharedAccessCanonicalName();

    final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(
            policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient);

    final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(
            policy, groupPolicyIdentifier, ipRange, protocols, signature);

    return builder.toString();
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:42,代码来源:CloudQueue.java


注:本文中的com.microsoft.azure.storage.core.StorageCredentialsHelper.canCredentialsSignRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。