Skip to content

Commit

Permalink
Address some of David's review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
trentjeff committed Sep 22, 2023
1 parent aa54950 commit e6ba175
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class DefaultOciCertificatesTlsManager extends ConfiguredTlsManager implements O
private ScheduledExecutorService asyncExecutor;
private Async async;
private WebServerTls tlsConfig;
private volatile X509KeyManager keyManager;
private volatile X509TrustManager trustManager;

DefaultOciCertificatesTlsManager(OciCertificatesTlsManagerConfig cfg) {
this(cfg, "@default", null);
Expand Down Expand Up @@ -114,16 +112,6 @@ public void init(WebServerTls tls) {
OciCertificatesTlsManagerConfig.class.getSimpleName() + " scheduled: " + taskIntervalDescription);
}

@Override // TlsManager
public Optional<X509KeyManager> keyManager() {
return Optional.ofNullable(keyManager);
}

@Override // TlsManager
public Optional<X509TrustManager> trustManager() {
return Optional.ofNullable(trustManager);
}

private void shutdown(Object event) {
try {
LOGGER.log(System.Logger.Level.DEBUG, "Shutting down");
Expand All @@ -133,11 +121,6 @@ private void shutdown(Object event) {
}
}

// @Override // RuntimeType
OciCertificatesTlsManagerConfig prototype() {
return cfg;
}

// ConfiguredTlsManager
private void maybeReload() {
if (loadContext(false)) {
Expand Down Expand Up @@ -206,9 +189,6 @@ boolean loadContext(boolean initialLoad) {
throw new RuntimeException("Unable to find X.509 trust manager in download: " + cfg.certOcid());
}

this.keyManager = keyManager.get();
this.trustManager = trustManager.get();

if (initialLoad) {
initSslContext(tlsConfig, kmf.getKeyManagers(), tmf.getTrustManagers());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;

Expand All @@ -37,8 +36,6 @@
import javax.net.ssl.SSLSessionContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;

import io.helidon.common.LazyValue;
import io.helidon.common.pki.KeyConfig;
Expand Down Expand Up @@ -102,16 +99,6 @@ public void subscribe(Consumer<SSLContext> sslContextConsumer) {
sslContextConsumers.add(Objects.requireNonNull(sslContextConsumer));
}

@Override // TlsManager
public Optional<X509KeyManager> keyManager() {
return Optional.empty();
}

@Override // TlsManager
public Optional<X509TrustManager> trustManager() {
return Optional.empty();
}

@Override // TlsManager
public void init(WebServerTls tlsConfig) {
SSLContext explicitSslContext = tlsConfig.explicitSslContext().orElse(null);
Expand All @@ -120,7 +107,7 @@ public void init(WebServerTls tlsConfig) {
return;
}

if (null == tlsConfig.privateKeyConfig()) {
if (tlsConfig.privateKeyConfig() == null) {
throw new IllegalStateException("Private key must be configured when SSL is enabled.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@

package io.helidon.webserver;

import java.util.Optional;
import java.util.function.Consumer;

import javax.net.ssl.SSLContext;
import javax.net.ssl.X509KeyManager;
import javax.net.ssl.X509TrustManager;

/**
* Implementors of this contract are responsible for managing the {@link javax.net.ssl.SSLContext} instance lifecycle. When the
Expand Down Expand Up @@ -58,18 +55,4 @@ public interface TlsManager {
*/
SSLContext sslContext();

/**
* The key manager in use, if available.
*
* @return key manager
*/
Optional<X509KeyManager> keyManager();

/**
* The trust manager in use, if available.
*
* @return trust manager
*/
Optional<X509TrustManager> trustManager();

}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public final class WebServerTls {
private final Set<String> enabledTlsProtocols;
private final Set<String> cipherSuite;
private final SSLContext explicitSslContext;
private KeyConfig privateKeyConfig;
private KeyConfig trustConfig;
private final KeyConfig privateKeyConfig;
private final KeyConfig trustConfig;
private final boolean trustAll;
private final int sessionCacheSize;
private final int sessionTimeoutSeconds;
Expand Down

0 comments on commit e6ba175

Please sign in to comment.