Package com.version1.secretsmanagement
Class SecretsManagement
java.lang.Object
com.version1.secretsmanagement.SecretsManagement
SecretsManagement class providing support methods to access the secrets from Azure key vault
Use this set access and delete the secrets from the Azure key vault
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteSecret(String keyVaultName, String secretName) Deletes the secret from Azure key vaultstatic StringGets the secret from Azure key vaultstatic com.azure.security.keyvault.secrets.SecretClientsecretBuilder(String keyVaultName) Authenticated the connection to the Azure Key Vault using KeyVault URL The authentication is done using Default credentials builder methodstatic voidSets the secret in the Azure key vault
-
Constructor Details
-
SecretsManagement
public SecretsManagement()
-
-
Method Details
-
secretBuilder
public static com.azure.security.keyvault.secrets.SecretClient secretBuilder(String keyVaultName) throws InterruptedException, IllegalArgumentException Authenticated the connection to the Azure Key Vault using KeyVault URL The authentication is done using Default credentials builder method- Parameters:
keyVaultName- used in the Azure portal- Returns:
- SecretClient synchronous methods to manage secrets in the Azure Key Vault
- Throws:
InterruptedExceptionIllegalArgumentException
-
setSecret
public static void setSecret(String keyVaultName, String secretName, String secretValue) throws InterruptedException, IllegalArgumentException Sets the secret in the Azure key vault- Parameters:
keyVaultName- used in the Azure portalsecretName- , Name to be assigned to the new secretsecretValue- , value of the secret- Throws:
InterruptedExceptionIllegalArgumentException
-
getSecret
public static String getSecret(String keyVaultName, String secretName) throws InterruptedException, IllegalArgumentException Gets the secret from Azure key vault- Parameters:
keyVaultName- used in the Azure portalsecretName- , Name of the secret to be fetched from the Azure key vault- Returns:
- retrieved secret
- Throws:
InterruptedExceptionIllegalArgumentException
-
deleteSecret
public static void deleteSecret(String keyVaultName, String secretName) throws InterruptedException, IllegalArgumentException Deletes the secret from Azure key vault- Parameters:
keyVaultName- used in the Azure portalsecretName- , Name of the secret to be deleted from the Azure key vault- Throws:
InterruptedExceptionIllegalArgumentException
-