From f2dbea2ca2b54c17214beac824e440d11cc01d9e Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Wed, 10 Apr 2019 17:26:53 +0200 Subject: [PATCH] ssl: introduce SSLEngineConfigurator#setSSLParameters SSLParameters is a class introduced in java6 which can take over SSLEngineConfigurator. As a first step, let allow applications to use SSLParameters to configure SSLEngineConfigurator. Signed-off-by: Tigran Mkrtchyan --- .../grizzly/ssl/SSLEngineConfigurator.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLEngineConfigurator.java b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLEngineConfigurator.java index 841c8110fe..36300c25b8 100644 --- a/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLEngineConfigurator.java +++ b/modules/grizzly/src/main/java/org/glassfish/grizzly/ssl/SSLEngineConfigurator.java @@ -21,6 +21,7 @@ import java.util.logging.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLParameters; import org.glassfish.grizzly.Grizzly; /** @@ -272,6 +273,21 @@ public SSLEngineConfigurator setWantClientAuth(boolean wantClientAuth) { return this; } + /** + * Apply {@link SSLParameters} to this SSLEngineConfigurator. + * + * @param sslParameters + * @return this SSLEngineConfigurator + */ + public SSLEngineConfigurator setSSLParameters(SSLParameters sslParameters) { + this.setEnabledCipherSuites(sslParameters.getCipherSuites()); + this.setEnabledProtocols(sslParameters.getProtocols()); + this.setNeedClientAuth(sslParameters.getNeedClientAuth()); + this.setWantClientAuth(sslParameters.getWantClientAuth()); + + return this; + } + /** * @return an array of enabled cipher suites. Modifications made on the array * content won't be propagated to SSLEngineConfigurator