use of com.quorum.tessera.config.KeyVaultConfig in project tessera by ConsenSys.
the class AzureKeyVaultHandlerTest method handleWithNullConfigOptions.
@Test
public void handleWithNullConfigOptions() {
KeyVaultConfig keyVaultConfig = azureKeyVaultHandler.handle(null);
assertThat(keyVaultConfig).isNotNull().isExactlyInstanceOf(AzureKeyVaultConfig.class);
assertThat(keyVaultConfig.getProperties()).isEmpty();
}
use of com.quorum.tessera.config.KeyVaultConfig in project tessera by ConsenSys.
the class HashicorpKeyVaultHandlerTest method handleNullOptions.
@Test
public void handleNullOptions() {
KeyVaultConfig result = keyVaultHandler.handle(null);
assertThat(result).isNotNull().isExactlyInstanceOf(HashicorpKeyVaultConfig.class);
}
use of com.quorum.tessera.config.KeyVaultConfig in project tessera by ConsenSys.
the class AwsKeyVaultHandlerTest method handleNullConfig.
@Test
public void handleNullConfig() {
KeyVaultConfig result = keyVaultHandler.handle(null);
assertThat(result).isNotNull().isExactlyInstanceOf(DefaultKeyVaultConfig.class);
assertThat(result.getKeyVaultType()).isEqualTo(KeyVaultType.AWS);
assertThat(result.getProperty("endpoint")).isNotPresent();
}
use of com.quorum.tessera.config.KeyVaultConfig in project tessera by ConsenSys.
the class AwsKeyVaultHandlerTest method handleWithVaultUrl.
@Test
public void handleWithVaultUrl() {
KeyVaultConfigOptions keyVaultConfig = mock(KeyVaultConfigOptions.class);
String endpointUrl = "http://someurl.com";
when(keyVaultConfig.getVaultUrl()).thenReturn(endpointUrl);
KeyVaultConfig result = keyVaultHandler.handle(keyVaultConfig);
assertThat(result).isNotNull().isExactlyInstanceOf(DefaultKeyVaultConfig.class);
assertThat(result.getKeyVaultType()).isEqualTo(KeyVaultType.AWS);
assertThat(result.getProperty("endpoint")).contains(endpointUrl);
}
use of com.quorum.tessera.config.KeyVaultConfig in project tessera by ConsenSys.
the class HashicorpKeyVaultServiceFactoryUtilTest method configureClientAuthenticationIfAllEnvVarsSetThenAppRoleMethod.
@Test
public void configureClientAuthenticationIfAllEnvVarsSetThenAppRoleMethod() {
KeyVaultConfig keyVaultConfig = mock(KeyVaultConfig.class);
EnvironmentVariableProvider envProvider = mock(EnvironmentVariableProvider.class);
ClientHttpRequestFactory clientHttpRequestFactory = mock(ClientHttpRequestFactory.class);
VaultEndpoint vaultEndpoint = mock(VaultEndpoint.class);
when(envProvider.getEnv(HASHICORP_ROLE_ID)).thenReturn("role-id");
when(envProvider.getEnv(HASHICORP_SECRET_ID)).thenReturn("secret-id");
when(envProvider.getEnv(HASHICORP_TOKEN)).thenReturn("token");
when(keyVaultConfig.getProperty("approlePath")).thenReturn(Optional.of("approle"));
ClientAuthentication result = util.configureClientAuthentication(keyVaultConfig, envProvider, clientHttpRequestFactory, vaultEndpoint);
assertThat(result).isInstanceOf(AppRoleAuthentication.class);
}
Aggregations