Skip to content

Commit e4c3bf5

Browse files
jansupolsenivam
authored andcommitted
Add URL of KeyStore and TrustStore to SslConfigurator
Put back some Nio Paths usages reverted in 5392 Signed-off-by: jansupol <[email protected]>
1 parent ed25486 commit e4c3bf5

File tree

5 files changed

+157
-110
lines changed

5 files changed

+157
-110
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
17+
package org.glassfish.jersey.jdk.connector.internal;
18+
19+
import org.glassfish.jersey.SslConfigurator;
20+
21+
public class SslFilterTLS13UrlStoresTest extends SslFilterTest {
22+
23+
public SslFilterTLS13UrlStoresTest() {
24+
System.setProperty("jdk.tls.server.protocols", "TLSv1.3");
25+
System.setProperty("jdk.tls.client.protocols", "TLSv1.3");
26+
}
27+
28+
@Override
29+
protected SslConfigurator getSslConfigurator() {
30+
return SslConfigurator.newInstance()
31+
.trustStoreUrl(this.getClass().getResource("/truststore_client"))
32+
.trustStorePassword("asdfgh")
33+
.keyStoreUrl(this.getClass().getResource("/keystore_client"))
34+
.keyStorePassword("asdfgh");
35+
}
36+
}

connectors/jdk-connector/src/test/java/org/glassfish/jersey/jdk/connector/internal/SslFilterTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -388,11 +388,7 @@ private Filter<ByteBuffer, ByteBuffer, ByteBuffer, ByteBuffer> openClientSocket(
388388
final CountDownLatch completionLatch,
389389
HostnameVerifier customHostnameVerifier)
390390
throws Throwable {
391-
SslConfigurator sslConfig = SslConfigurator.newInstance()
392-
.trustStoreFile(this.getClass().getResource("/truststore_client").getPath())
393-
.trustStorePassword("asdfgh")
394-
.keyStoreFile(this.getClass().getResource("/keystore_client").getPath())
395-
.keyStorePassword("asdfgh");
391+
SslConfigurator sslConfig = getSslConfigurator();
396392

397393
TransportFilter transportFilter = new TransportFilter(17_000, ThreadPoolConfig.defaultConfig(), 100_000);
398394
final SSLParamConfigurator sslParamConfigurator = SSLParamConfigurator.builder()
@@ -481,6 +477,14 @@ void close() {
481477
return clientSocket;
482478
}
483479

480+
protected SslConfigurator getSslConfigurator() {
481+
return SslConfigurator.newInstance()
482+
.trustStoreFile(this.getClass().getResource("/truststore_client").getPath())
483+
.trustStorePassword("asdfgh")
484+
.keyStoreFile(this.getClass().getResource("/keystore_client").getPath())
485+
.keyStorePassword("asdfgh");
486+
}
487+
484488
/**
485489
* SSL echo server. It expects a message to be terminated with \n.
486490
*/

0 commit comments

Comments
 (0)