diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-09-05 12:52:27 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-09-05 12:52:27 +0200 |
commit | c6820ac582e67a40f8411e26bc4c9c1c0b7e8099 (patch) | |
tree | 094e22dba07df60a22164074e971b406ab0cc91b /node-admin | |
parent | e437b35c7520bf73078864dab297374211ad57ca (diff) |
Suppress deprecation warning in AthenzCredentialsMaintainer
Diffstat (limited to 'node-admin')
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/AthenzCredentialsMaintainer.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/AthenzCredentialsMaintainer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/AthenzCredentialsMaintainer.java index f82047d885c..ade46182efc 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/AthenzCredentialsMaintainer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/identity/AthenzCredentialsMaintainer.java @@ -13,12 +13,6 @@ import com.yahoo.vespa.athenz.identityprovider.api.SignedIdentityDocument; import com.yahoo.vespa.athenz.identityprovider.client.DefaultIdentityDocumentClient; import com.yahoo.vespa.athenz.identityprovider.client.InstanceCsrGenerator; import com.yahoo.vespa.athenz.tls.AthenzIdentityVerifier; -import com.yahoo.vespa.athenz.tls.KeyAlgorithm; -import com.yahoo.vespa.athenz.tls.KeyStoreType; -import com.yahoo.vespa.athenz.tls.KeyUtils; -import com.yahoo.vespa.athenz.tls.Pkcs10Csr; -import com.yahoo.vespa.athenz.tls.SslContextBuilder; -import com.yahoo.vespa.athenz.tls.X509CertificateUtils; import com.yahoo.vespa.athenz.utils.SiaUtils; import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.node.admin.component.Environment; @@ -46,6 +40,7 @@ import static java.util.Collections.singleton; * * @author bjorncs */ +@SuppressWarnings("deprecation") public class AthenzCredentialsMaintainer { private static final Duration EXPIRY_MARGIN = Duration.ofDays(1); @@ -162,7 +157,7 @@ public class AthenzCredentialsMaintainer { private X509Certificate readCertificateFromFile() throws IOException { String pemEncodedCertificate = new String(Files.readAllBytes(certificateFile)); - return X509CertificateUtils.fromPem(pemEncodedCertificate); + return com.yahoo.vespa.athenz.tls.X509CertificateUtils.fromPem(pemEncodedCertificate); } private boolean isCertificateExpired(Instant expiry, Instant now) { @@ -170,9 +165,9 @@ public class AthenzCredentialsMaintainer { } private void registerIdentity() { - KeyPair keyPair = KeyUtils.generateKeypair(KeyAlgorithm.RSA); + KeyPair keyPair = com.yahoo.vespa.athenz.tls.KeyUtils.generateKeypair(com.yahoo.vespa.athenz.tls.KeyAlgorithm.RSA); SignedIdentityDocument signedIdentityDocument = identityDocumentClient.getNodeIdentityDocument(hostname); - Pkcs10Csr csr = csrGenerator.generateCsr( + com.yahoo.vespa.athenz.tls.Pkcs10Csr csr = csrGenerator.generateCsr( containerIdentity, signedIdentityDocument.providerUniqueId(), signedIdentityDocument.ipAddresses(), keyPair); try (ZtsClient ztsClient = new DefaultZtsClient(ztsEndpoint, hostIdentityProvider)) { InstanceIdentity instanceIdentity = @@ -193,12 +188,12 @@ public class AthenzCredentialsMaintainer { private void refreshIdentity() { SignedIdentityDocument identityDocument = EntityBindingsMapper.readSignedIdentityDocumentFromFile(identityDocumentFile); - KeyPair keyPair = KeyUtils.generateKeypair(KeyAlgorithm.RSA); - Pkcs10Csr csr = csrGenerator.generateCsr(containerIdentity, identityDocument.providerUniqueId(), identityDocument.ipAddresses(), keyPair); + KeyPair keyPair = com.yahoo.vespa.athenz.tls.KeyUtils.generateKeypair(com.yahoo.vespa.athenz.tls.KeyAlgorithm.RSA); + com.yahoo.vespa.athenz.tls.Pkcs10Csr csr = csrGenerator.generateCsr(containerIdentity, identityDocument.providerUniqueId(), identityDocument.ipAddresses(), keyPair); SSLContext containerIdentitySslContext = - new SslContextBuilder() + new com.yahoo.vespa.athenz.tls.SslContextBuilder() .withKeyStore(privateKeyFile.toFile(), certificateFile.toFile()) - .withTrustStore(trustStorePath.toFile(), KeyStoreType.JKS) + .withTrustStore(trustStorePath.toFile(), com.yahoo.vespa.athenz.tls.KeyStoreType.JKS) .build(); try { try (ZtsClient ztsClient = new DefaultZtsClient(ztsEndpoint, containerIdentity, containerIdentitySslContext)) { @@ -226,9 +221,9 @@ public class AthenzCredentialsMaintainer { private void writePrivateKeyAndCertificate(PrivateKey privateKey, X509Certificate certificate) throws IOException { Path tempPrivateKeyFile = toTempPath(privateKeyFile); - Files.write(tempPrivateKeyFile, KeyUtils.toPem(privateKey).getBytes()); + Files.write(tempPrivateKeyFile, com.yahoo.vespa.athenz.tls.KeyUtils.toPem(privateKey).getBytes()); Path tempCertificateFile = toTempPath(certificateFile); - Files.write(tempCertificateFile, X509CertificateUtils.toPem(certificate).getBytes()); + Files.write(tempCertificateFile, com.yahoo.vespa.athenz.tls.X509CertificateUtils.toPem(certificate).getBytes()); Files.move(tempPrivateKeyFile, privateKeyFile, StandardCopyOption.ATOMIC_MOVE); Files.move(tempCertificateFile, certificateFile, StandardCopyOption.ATOMIC_MOVE); |