StorageCredentials Class
- java.
lang. Object - com.
microsoft. azure. storage. StorageCredentials
- com.
public class StorageCredentials
Represents a set of credentials used to authenticate access to a Microsoft Azure storage account. This is the base class for the StorageCredentialsAccountAndKey, StorageCredentialsToken, and StorageCredentialsSharedAccessSignature classes.
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getAccountName()
Returns the associated account name for the credentials. This is null for anonymous and shared access signature credentials. |
boolean |
isHttpsOnly()
Gets whether this object only allows access via HTTPS. |
void |
setHttpsOnly(boolean httpsOnly)
Sets whether this object only allows access via HTTPS. |
abstract String |
toString(boolean exportSecrets)
Returns a that represents this instance. |
URI |
transformUri(final URI resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token. |
Storage |
transformUri(StorageUri resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token. |
abstract Storage |
transformUri(StorageUri resourceUri, OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the specified operation context. |
abstract URI |
transformUri(URI resourceUri, OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the specified operation context. |
Storage |
tryParseCredentials(final Map<String, String> settings)
Tries to determine the storage credentials from a collection of name/value pairs. Either include an account name with an account key (specifying values for ACCOUNT_NAME_NAME and ACCOUNT_KEY_NAME ), or a shared access signature (specifying a value for SHARED_ACCESS_SIGNATURE_NAME ). If you use an account name and account key, do not include a shared access signature, and vice versa. |
Storage |
tryParseCredentials(final String connectionString)
Tries to determine the storage credentials from a connection string. The format for the connection string is in the pattern "<i>keyname=value</i>". Multiple key/value pairs can be separated by a semi-colon, for example, "<i>keyname1=value1;keyname2=value2</i>". Either include an account name with an account key or a shared access signature. If you use an account name and account key, do not include a shared access signature, and vice versa. The same connection string can be used as for parse(final String connectionString) but here only the account name, account key, and sas key/value pairs will be examined. |
Method Details
getAccountName
public String getAccountName()
Returns the associated account name for the credentials. This is null for anonymous and shared access signature credentials.
Returns:
String
that represents the associated account name for the credentialsisHttpsOnly
public boolean isHttpsOnly()
Gets whether this object only allows access via HTTPS.
Returns:
boolean
representing whether this StorageCredentials
object only allows access via HTTPS.setHttpsOnly
protected void setHttpsOnly(boolean httpsOnly)
Sets whether this object only allows access via HTTPS.
Parameters:
boolean
representing whether this StorageCredentials
object only allows access via HTTPS.
toString
public abstract String toString(boolean exportSecrets)
Returns a that represents this instance.
Parameters:
true
to include sensitive data in the return string; otherwise, false
.
Returns:
String
that represents this object, optionally including sensitive data.transformUri
public URI transformUri(final URI resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token.
Parameters:
java.net.URI
object that represents the resource URI to be transformed.
Returns:
java.net.URI
object that represents the signature, including the resource URI and the shared access token.Throws:
transformUri
public StorageUri transformUri(StorageUri resourceUri)
Transforms a resource URI into a shared access signature URI, by appending a shared access token.
Parameters:
StorageUri
object that represents the resource URI to be transformed.
Returns:
StorageUri
object that represents the signature, including the resource URI and the shared access token.Throws:
transformUri
public abstract StorageUri transformUri(StorageUri resourceUri, OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the specified operation context.
Parameters:
StorageUri
object that represents the resource URI to be transformed.
Returns:
StorageUri
object that represents the signature, including the resource URI and the shared access token.Throws:
transformUri
public abstract URI transformUri(URI resourceUri, OperationContext opContext)
Transforms a resource URI into a shared access signature URI, by appending a shared access token and using the specified operation context.
Parameters:
java.net.URI
object that represents the resource URI to be transformed.
Returns:
java.net.URI
object that represents the signature, including the resource URI and the shared access token.Throws:
tryParseCredentials
protected static StorageCredentials tryParseCredentials(final Map
Tries to determine the storage credentials from a collection of name/value pairs.
Either include an account name with an account key (specifying values for ACCOUNT_NAME_NAME and ACCOUNT_KEY_NAME ), or a shared access signature (specifying a value for SHARED_ACCESS_SIGNATURE_NAME ). If you use an account name and account key, do not include a shared access signature, and vice versa.
Parameters:
Map
object of the name/value pairs that represent the settings to use to configure the credentials.
Returns:
Throws:
tryParseCredentials
public static StorageCredentials tryParseCredentials(final String connectionString)
Tries to determine the storage credentials from a connection string.
The format for the connection string is in the pattern "<i>keyname=value</i>". Multiple key/value pairs can be separated by a semi-colon, for example, "<i>keyname1=value1;keyname2=value2</i>". Either include an account name with an account key or a shared access signature. If you use an account name and account key, do not include a shared access signature, and vice versa.
The same connection string can be used as for parse(final String connectionString) but here only the account name, account key, and sas key/value pairs will be examined.
Parameters:
String
that contains the key/value pairs that represent the storage credentials.
Returns:
Throws:
connectionString
is not valid.
Applies to
Azure SDK for Java