aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-athenz/src/test
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-05-15 13:20:13 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-05-18 13:31:05 +0200
commit848fa86f8836ba6b7d5840cc59b46dff9111010e (patch)
tree292fc162b0b8c7d7d2a8ef7ba546fe63bfc167f9 /vespa-athenz/src/test
parent480d205734db359a707c75768facf1aabea5acf4 (diff)
Provide path to trust stores from ServiceIdentityProvider
Model distinction between the Athenz and client trust store. Cleanup constructors and config for SiaIdentityProvider.
Diffstat (limited to 'vespa-athenz/src/test')
-rw-r--r--vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identity/SiaIdentityProviderTest.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identity/SiaIdentityProviderTest.java b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identity/SiaIdentityProviderTest.java
index 1fe32561f82..b7db502b1d0 100644
--- a/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identity/SiaIdentityProviderTest.java
+++ b/vespa-athenz/src/test/java/com/yahoo/vespa/athenz/identity/SiaIdentityProviderTest.java
@@ -2,15 +2,11 @@
package com.yahoo.vespa.athenz.identity;
import com.yahoo.security.KeyAlgorithm;
-import com.yahoo.security.KeyStoreBuilder;
-import com.yahoo.security.KeyStoreType;
-import com.yahoo.security.KeyStoreUtils;
import com.yahoo.security.KeyUtils;
import com.yahoo.security.SignatureAlgorithm;
import com.yahoo.security.X509CertificateBuilder;
import com.yahoo.security.X509CertificateUtils;
import com.yahoo.vespa.athenz.api.AthenzService;
-import com.yahoo.yolean.Exceptions;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -21,11 +17,11 @@ import java.io.IOException;
import java.math.BigInteger;
import java.nio.file.Files;
import java.security.KeyPair;
-import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.time.Duration;
import java.time.Instant;
+import static com.yahoo.yolean.Exceptions.uncheck;
import static org.junit.Assert.assertNotNull;
/**
@@ -55,7 +51,7 @@ public class SiaIdentityProviderTest {
keyFile.toPath(),
certificateFile.toPath(),
trustStoreFile.toPath(),
- SiaProviderConfig.TrustStoreType.Enum.jks);
+ trustStoreFile.toPath());
assertNotNull(provider.getIdentitySslContext());
}
@@ -79,7 +75,7 @@ public class SiaIdentityProviderTest {
keyFile.toPath(),
certificateFile.toPath(),
trustStoreFile.toPath(),
- SiaProviderConfig.TrustStoreType.Enum.pem);
+ trustStoreFile.toPath());
assertNotNull(provider.getIdentitySslContext());
}
@@ -109,14 +105,11 @@ public class SiaIdentityProviderTest {
private void createPemTrustStoreFile(X509Certificate certificate, File trustStoreFile) {
var pemEncoded = X509CertificateUtils.toPem(certificate);
- Exceptions.uncheck(() -> Files.writeString(trustStoreFile.toPath(), pemEncoded));
+ uncheck(() -> Files.writeString(trustStoreFile.toPath(), pemEncoded));
}
private void createTrustStoreFile(X509Certificate certificate, File trustStoreFile) {
- KeyStore keystore = KeyStoreBuilder.withType(KeyStoreType.JKS)
- .withCertificateEntry("dummy-cert", certificate)
- .build();
- KeyStoreUtils.writeKeyStoreToFile(keystore, trustStoreFile.toPath());
+ uncheck(() -> Files.writeString(trustStoreFile.toPath(), X509CertificateUtils.toPem(certificate)));
}
}