diff options
Diffstat (limited to 'jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/DefaultSslTrustStoreContext.java')
-rw-r--r-- | jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/DefaultSslTrustStoreContext.java | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/DefaultSslTrustStoreContext.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/DefaultSslTrustStoreContext.java deleted file mode 100644 index c2d91cca3ea..00000000000 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/ssl/DefaultSslTrustStoreContext.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.jdisc.http.ssl; - -import org.eclipse.jetty.util.ssl.SslContextFactory; - -import java.security.KeyStore; -import java.util.function.Consumer; - -/** - * @author bjorncs - */ -public class DefaultSslTrustStoreContext implements SslTrustStoreContext { - - private final SslContextFactory sslContextFactory; - - public DefaultSslTrustStoreContext(SslContextFactory sslContextFactory) { - this.sslContextFactory = sslContextFactory; - } - - @Override - public void updateTrustStore(KeyStore trustStore) { - updateTrustStore(trustStore, null); - } - - @Override - public void updateTrustStore(KeyStore trustStore, String password) { - updateTrustStore(sslContextFactory -> { - sslContextFactory.setTrustStore(trustStore); - if (password != null) { - sslContextFactory.setTrustStorePassword(password); - } - }); - } - - @Override - public void updateTrustStore(String trustStorePath, String trustStoreType, String trustStorePassword) { - updateTrustStore(sslContextFactory -> { - sslContextFactory.setTrustStorePath(trustStorePath); - sslContextFactory.setTrustStoreType(trustStoreType); - if (trustStorePassword != null) { - sslContextFactory.setTrustStorePassword(trustStorePassword); - } - }); - } - - private void updateTrustStore(Consumer<SslContextFactory> reloader) { - try { - sslContextFactory.reload(reloader); - } catch (Exception e) { - throw new RuntimeException("Could not update truststore: " + e.getMessage(), e); - } - } - -} |