當前位置: 首頁>>代碼示例>>Java>>正文


Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法代碼示例

本文整理匯總了Java中com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的典型用法代碼示例。如果您正苦於以下問題:Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的具體用法?Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile怎麽用?Java SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.microsoft.azure.storage.core.SharedAccessSignatureHelper的用法示例。


在下文中一共展示了SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的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

示例2: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的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

示例3: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的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

示例4: generateSharedAccessSignature

import com.microsoft.azure.storage.core.SharedAccessSignatureHelper; //導入方法依賴的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


注:本文中的com.microsoft.azure.storage.core.SharedAccessSignatureHelper.generateSharedAccessSignatureHashForBlobAndFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。