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 26793ef79..dcc94cd83 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -249,7 +249,7 @@ public SSLEngineConfigurator setWantClientAuth(boolean wantClientAuth) { * @return this SSLEngineConfigurator */ public SSLEngineConfigurator setSSLParameters(SSLParameters sslParameters) { - this.sslParameters = copy(this.sslParameters); + this.sslParameters = copy(sslParameters); return this; } diff --git a/modules/grizzly/src/test/java/org/glassfish/grizzly/SSLTest.java b/modules/grizzly/src/test/java/org/glassfish/grizzly/SSLTest.java index 614ecf776..a262851e7 100644 --- a/modules/grizzly/src/test/java/org/glassfish/grizzly/SSLTest.java +++ b/modules/grizzly/src/test/java/org/glassfish/grizzly/SSLTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -17,6 +17,7 @@ package org.glassfish.grizzly; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -45,6 +46,7 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.SSLParameters; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; @@ -370,6 +372,22 @@ public void updated(Object result) { } + + @Test + public void testSetSSLParameters() { + + SSLContextConfigurator sslContextConfigurator = createSSLContextConfigurator(); + SSLEngineConfigurator serverSSLEngineConfigurator = new SSLEngineConfigurator(sslContextConfigurator.createSSLContext(true), false, false, false); + + assertFalse("Invalid initial value of NeedClientAuth", serverSSLEngineConfigurator.isNeedClientAuth()); + + SSLParameters sslParameters = new SSLParameters(); + sslParameters.setNeedClientAuth(true); + serverSSLEngineConfigurator.setSSLParameters(sslParameters); + + assertTrue("SSL params not propagated", serverSSLEngineConfigurator.isNeedClientAuth()); + } + // ------------------------------------------------------- Protected Methods protected void doTestPingPongFilterChain(boolean isBlocking, int turnAroundsNum, int filterIndex, Filter... filters) throws Exception {