use of com.azure.security.keyvault.secrets.models.KeyVaultSecret in project lowkey-vault by nagyesta.
the class SecretsStepDefs method secretIsRecovered.
@When("secret is recovered")
public void secretIsRecovered() {
final DeletedSecret deleted = context.getLastDeleted();
final KeyVaultSecret secret = context.getClient(context.getSecretServiceVersion()).beginRecoverDeletedSecret(deleted.getName()).waitForCompletion().getValue();
context.addFetchedSecret(secret.getName(), secret);
}
use of com.azure.security.keyvault.secrets.models.KeyVaultSecret in project lowkey-vault by nagyesta.
the class SecretsStepDefs method fetchFirstSecretVersion.
@When("the first secret version of {name} is fetched with providing a version")
public void fetchFirstSecretVersion(final String name) {
final List<KeyVaultSecret> versionsCreated = context.getCreatedEntities().get(name);
final String version = versionsCreated.get(0).getProperties().getVersion();
final KeyVaultSecret secret = context.getClient(context.getSecretServiceVersion()).getSecret(name, version);
context.addFetchedSecret(name, secret);
assertEquals(version, secret.getProperties().getVersion());
}
use of com.azure.security.keyvault.secrets.models.KeyVaultSecret in project lowkey-vault by nagyesta.
the class SecretsStepDefs method secretCreationRequestIsSent.
@When("the secret is created")
public void secretCreationRequestIsSent() {
final KeyVaultSecret secretCreateInfo = context.getCreateSecretOptions();
final KeyVaultSecret secret = context.getClient(context.getSecretServiceVersion()).setSecret(secretCreateInfo);
context.addCreatedEntity(secretCreateInfo.getName(), secret);
}
use of com.azure.security.keyvault.secrets.models.KeyVaultSecret in project tessera by ConsenSys.
the class AzureKeyVaultServiceTest method getSecret.
@Test
public void getSecret() {
final String secretName = "secret-name";
final String secretVersion = "secret-version";
final Map<String, String> getSecretData = Map.of(AzureKeyVaultService.SECRET_NAME_KEY, secretName, AzureKeyVaultService.SECRET_VERSION_KEY, secretVersion);
final String expectedSecretValue = "secret-value";
final KeyVaultSecret gotSecret = mock(KeyVaultSecret.class);
when(gotSecret.getValue()).thenReturn(expectedSecretValue);
when(secretClient.getSecret(anyString(), anyString())).thenReturn(gotSecret);
final String result = keyVaultService.getSecret(getSecretData);
assertThat(result).isEqualTo(expectedSecretValue);
verify(secretClient).getSecret(secretName, secretVersion);
}
Aggregations