Class AzureNamedKeyCredential
The AzureNamedKeyCredential is used to authenticate and authorize requests made to Azure services.
It is specifically designed for scenarios where you need to authenticate using a key with a name identifier
associated with it.
A key is a unique identifier or token that is associated with a specific user or application. It serves as a simple form of authentication to ensure that only authorized clients can access the protected resources or APIs. This authentication is commonly used for accessing certain services, such as Azure Tables and Azure Event Hubs. Each service may have its own specific way of using API keys, but the general concept remains the same.
The AzureNamedKeyCredential can be created for keys which have a name
identifier associated with them.
Code Samples
Create a named credential for a service specific sas key.
AzureNamedKeyCredential azureNamedKeyCredential =
new AzureNamedKeyCredential("AZURE-SERVICE-SAS-KEY-NAME", "AZURE-SERVICE-SAS-KEY");
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAzureNamedKeyCredential(String name, String key) Creates a credential with specifiednamethat authorizes request with the givenkey. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves theAzureNamedKeycontaining the name and key associated with this credential.Rotates thenameandkeyassociated to this credential.
-
Constructor Details
-
AzureNamedKeyCredential
Creates a credential with specifiednamethat authorizes request with the givenkey.- Parameters:
name- The name of the key credential.key- The key used to authorize requests.- Throws:
NullPointerException- Ifkeyornameisnull.IllegalArgumentException- Ifkeyornameis an empty string.
-
-
Method Details
-
getAzureNamedKey
Retrieves theAzureNamedKeycontaining the name and key associated with this credential.- Returns:
- The
AzureNamedKeycontaining the name and key .
-
update
Rotates thenameandkeyassociated to this credential.- Parameters:
name- The new name of the key credential.key- The new key to be associated with this credential.- Returns:
- The updated
AzureNamedKeyCredentialobject. - Throws:
NullPointerException- Ifkeyornameisnull.IllegalArgumentException- Ifkeyornameis an empty string.
-