你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
StorageSharedKeyCredential Class
- java.
lang. Object - com.
azure. storage. common. StorageSharedKeyCredential
- com.
public final class StorageSharedKeyCredential
SharedKey credential policy that is put into a header to authorize requests.
Constructor Summary
Constructor | Description |
---|---|
StorageSharedKeyCredential(String accountName, String accountKey) |
Initializes a new instance of Storage |
Method Summary
Methods inherited from java.lang.Object
Constructor Details
StorageSharedKeyCredential
public StorageSharedKeyCredential(String accountName, String accountKey)
Initializes a new instance of StorageSharedKeyCredential contains an account's name and its primary or secondary accountKey.
Parameters:
Method Details
computeHmac256
public String computeHmac256(String stringToSign)
Computes a signature for the specified string using the HMAC-SHA256 algorithm. Package-private because it is used to generate SAS signatures.
Parameters:
Returns:
String
that contains the HMAC-SHA256-encoded signature.fromAzureNamedKeyCredential
public static StorageSharedKeyCredential fromAzureNamedKeyCredential(AzureNamedKeyCredential azureNamedKeyCredential)
Creates a SharedKey credential from the passed AzureNamedKeyCredential.
Parameters:
Returns:
fromConnectionString
public static StorageSharedKeyCredential fromConnectionString(String connectionString)
Creates a SharedKey credential from the passed connection string.
Code Samples
StorageSharedKeyCredential credential = StorageSharedKeyCredential.fromConnectionString(connectionString);
Parameters:
Returns:
generateAuthorizationHeader
public String generateAuthorizationHeader(URL requestURL, String httpMethod, HttpHeaders headers, boolean logStringToSign)
Generates the SharedKey Authorization value from information in the request.
Parameters:
Returns:
generateAuthorizationHeader
public String generateAuthorizationHeader(URL requestURL, String httpMethod, Map
Generates the SharedKey Authorization value from information in the request.
Parameters:
Returns:
generateAuthorizationHeader
public String generateAuthorizationHeader(URL requestURL, String httpMethod, Map
Generates the SharedKey Authorization value from information in the request.
Parameters:
Returns:
getAccountName
public String getAccountName()
Gets the account name associated with the request.
Returns:
getSharedKeyCredentialFromPipeline
public static StorageSharedKeyCredential getSharedKeyCredentialFromPipeline(HttpPipeline httpPipeline)
Searches for a StorageSharedKeyCredential in the HttpPipeline.
Parameters:
Returns: