Search in sources :

Example 6 with DefaultKeyVaultConfig

use of com.quorum.tessera.config.DefaultKeyVaultConfig in project tessera by ConsenSys.

the class KeyVaultConfigValidatorTest method validHashicorpConfig.

@Test
public void validHashicorpConfig() throws Exception {
    Path somePath = Files.createTempFile(UUID.randomUUID().toString(), ".txt");
    somePath.toFile().deleteOnExit();
    DefaultKeyVaultConfig config = new DefaultKeyVaultConfig();
    config.setKeyVaultType(KeyVaultType.HASHICORP);
    config.setProperty("url", "someurl");
    config.setProperty("tlsKeyStorePath", somePath.toString());
    config.setProperty("tlsTrustStorePath", somePath.toString());
    assertThat(keyVaultConfigValidator.isValid(config, context)).isTrue();
}
Also used : Path(java.nio.file.Path) DefaultKeyVaultConfig(com.quorum.tessera.config.DefaultKeyVaultConfig) Test(org.junit.Test)

Example 7 with DefaultKeyVaultConfig

use of com.quorum.tessera.config.DefaultKeyVaultConfig in project tessera by ConsenSys.

the class KeyVaultConfigValidatorTest method nullKeyVaultTypeIsAllowedAndWillBePickedUpByNotNullAnnotation.

@Test
public void nullKeyVaultTypeIsAllowedAndWillBePickedUpByNotNullAnnotation() {
    DefaultKeyVaultConfig config = new DefaultKeyVaultConfig();
    assertThat(keyVaultConfigValidator.isValid(config, context)).isTrue();
}
Also used : DefaultKeyVaultConfig(com.quorum.tessera.config.DefaultKeyVaultConfig) Test(org.junit.Test)

Example 8 with DefaultKeyVaultConfig

use of com.quorum.tessera.config.DefaultKeyVaultConfig in project tessera by ConsenSys.

the class KeyVaultConfigValidatorTest method invalidHashicorpConfig.

@Test
public void invalidHashicorpConfig() {
    Path somePath = mock(Path.class);
    DefaultKeyVaultConfig config = new DefaultKeyVaultConfig();
    config.setKeyVaultType(KeyVaultType.HASHICORP);
    config.setProperty("tlsKeyStorePath", somePath.toString());
    config.setProperty("tlsTrustStorePath", somePath.toString());
    assertThat(keyVaultConfigValidator.isValid(config, context)).isFalse();
}
Also used : Path(java.nio.file.Path) DefaultKeyVaultConfig(com.quorum.tessera.config.DefaultKeyVaultConfig) Test(org.junit.Test)

Example 9 with DefaultKeyVaultConfig

use of com.quorum.tessera.config.DefaultKeyVaultConfig in project tessera by ConsenSys.

the class KeyVaultConfigValidatorTest method invalidAzureConfig.

@Test
public void invalidAzureConfig() {
    DefaultKeyVaultConfig config = new DefaultKeyVaultConfig();
    config.setKeyVaultType(KeyVaultType.AZURE);
    assertThat(keyVaultConfigValidator.isValid(config, context)).isFalse();
}
Also used : DefaultKeyVaultConfig(com.quorum.tessera.config.DefaultKeyVaultConfig) Test(org.junit.Test)

Example 10 with DefaultKeyVaultConfig

use of com.quorum.tessera.config.DefaultKeyVaultConfig in project tessera by ConsenSys.

the class KeyVaultConfigValidatorTest method invalidAWSConfig.

@Test
public void invalidAWSConfig() {
    DefaultKeyVaultConfig config = new DefaultKeyVaultConfig();
    config.setKeyVaultType(KeyVaultType.AWS);
    config.setProperty("endpoint", "noscheme");
    assertThat(keyVaultConfigValidator.isValid(config, context)).isFalse();
}
Also used : DefaultKeyVaultConfig(com.quorum.tessera.config.DefaultKeyVaultConfig) Test(org.junit.Test)

Aggregations

DefaultKeyVaultConfig (com.quorum.tessera.config.DefaultKeyVaultConfig)12 Test (org.junit.Test)10 Path (java.nio.file.Path)2 EncryptorConfig (com.quorum.tessera.config.EncryptorConfig)1 KeyConfiguration (com.quorum.tessera.config.KeyConfiguration)1 KeyVaultConfig (com.quorum.tessera.config.KeyVaultConfig)1 KeyVaultType (com.quorum.tessera.config.KeyVaultType)1 AzureVaultKeyPair (com.quorum.tessera.config.keypairs.AzureVaultKeyPair)1 ConfigKeyPair (com.quorum.tessera.config.keypairs.ConfigKeyPair)1 KeyVaultService (com.quorum.tessera.key.vault.KeyVaultService)1 KeyVaultServiceFactory (com.quorum.tessera.key.vault.KeyVaultServiceFactory)1 ConstraintValidator (jakarta.validation.ConstraintValidator)1 ConstraintValidatorContext (jakarta.validation.ConstraintValidatorContext)1 ConstraintViolation (jakarta.validation.ConstraintViolation)1 Paths (java.nio.file.Paths)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1