public final class StorageSharedKeyCredential
SharedKey credential policy that is put into a header to authorize requests.
Constructor Summary Method Summary Modifier and Type Method and Description String computeHmac256(String stringToSign)Computes a signature for the specified string using the HMAC-SHA256 algorithm.
static StorageSharedKeyCredential fromAzureNamedKeyCredential(AzureNamedKeyCredential azureNamedKeyCredential)Creates a SharedKey credential from the passed AzureNamedKeyCredential.
static StorageSharedKeyCredential fromConnectionString(String connectionString)Creates a SharedKey credential from the passed connection string.
String generateAuthorizationHeader(URL requestURL, String httpMethod, HttpHeaders headers, boolean logStringToSign)Generates the SharedKey Authorization value from information in the request.
String generateAuthorizationHeader(URL requestURL, String httpMethod, Map<String,String> headers)Generates the SharedKey Authorization value from information in the request.
String generateAuthorizationHeader(URL requestURL, String httpMethod, Map<String,String> headers, boolean logStringToSign)Generates the SharedKey Authorization value from information in the request.
String getAccountName()Gets the account name associated with the request.
static StorageSharedKeyCredential getSharedKeyCredentialFromPipeline(HttpPipeline httpPipeline)Searches for a StorageSharedKeyCredential in the HttpPipeline.
Methods inherited from java.lang.Object Constructor Detailspublic StorageSharedKeyCredential(String accountName, String accountKey)
Initializes a new instance of StorageSharedKeyCredential contains an account's name and its primary or secondary accountKey.
Parameters:
accountName - The account name associated with the request.
accountKey - The account access key used to authenticate the request.
Method Detailspublic 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:
stringToSign - The UTF-8-encoded string to sign.
Returns:
A String
that contains the HMAC-SHA256-encoded signature.
public static StorageSharedKeyCredential fromAzureNamedKeyCredential(AzureNamedKeyCredential azureNamedKeyCredential)
Creates a SharedKey credential from the passed AzureNamedKeyCredential.
Parameters:
Returns:
public static StorageSharedKeyCredential fromConnectionString(String connectionString)
Creates a SharedKey credential from the passed connection string.
Code Samples
StorageSharedKeyCredential credential = StorageSharedKeyCredential.fromConnectionString(connectionString);
Parameters:
connectionString - Connection string used to build the SharedKey credential.
Returns:
a SharedKey credential if the connection string contains AccountName and AccountKey
public String generateAuthorizationHeader(URL requestURL, String httpMethod, HttpHeaders headers, boolean logStringToSign)
Generates the SharedKey Authorization value from information in the request.
Parameters:
requestURL - URL of the request
httpMethod - HTTP method being used
headers - Headers on the request
logStringToSign - Whether to log the string to sign
Returns:
the SharedKey authorization value
public String generateAuthorizationHeader(URL requestURL, String httpMethod, Map<String,String> headers)
Generates the SharedKey Authorization value from information in the request.
Parameters:
requestURL - URL of the request
httpMethod - HTTP method being used
headers - Headers on the request
Returns:
the SharedKey authorization value
public String generateAuthorizationHeader(URL requestURL, String httpMethod, Map<String,String> headers, boolean logStringToSign)
Generates the SharedKey Authorization value from information in the request.
Parameters:
requestURL - URL of the request
httpMethod - HTTP method being used
headers - Headers on the request
logStringToSign - Whether to log the string to sign
Returns:
the SharedKey authorization value
public String getAccountName()
Gets the account name associated with the request.
Returns:
The account name.
public static StorageSharedKeyCredential getSharedKeyCredentialFromPipeline(HttpPipeline httpPipeline)
Searches for a StorageSharedKeyCredential in the HttpPipeline.
Parameters:
httpPipeline - Pipeline being searched
Returns:
a StorageSharedKeyCredential if the pipeline contains one, otherwise null.
Applies toCollaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4