Skip to content

Commit

Permalink
Add URL of KeyStore and TrustStore to SslConfigurator
Browse files Browse the repository at this point in the history
Put back some Nio Paths usages reverted in 5392

Signed-off-by: jansupol <jan.supol@oracle.com>
  • Loading branch information
jansupol authored and senivam committed Jan 11, 2024
1 parent ed25486 commit e4c3bf5
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 110 deletions.
@@ -0,0 +1,36 @@
/*
* Copyright (c) 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
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.jersey.jdk.connector.internal;

import org.glassfish.jersey.SslConfigurator;

public class SslFilterTLS13UrlStoresTest extends SslFilterTest {

public SslFilterTLS13UrlStoresTest() {
System.setProperty("jdk.tls.server.protocols", "TLSv1.3");
System.setProperty("jdk.tls.client.protocols", "TLSv1.3");
}

@Override
protected SslConfigurator getSslConfigurator() {
return SslConfigurator.newInstance()
.trustStoreUrl(this.getClass().getResource("/truststore_client"))
.trustStorePassword("asdfgh")
.keyStoreUrl(this.getClass().getResource("/keystore_client"))
.keyStorePassword("asdfgh");
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand Down Expand Up @@ -388,11 +388,7 @@ private Filter<ByteBuffer, ByteBuffer, ByteBuffer, ByteBuffer> openClientSocket(
final CountDownLatch completionLatch,
HostnameVerifier customHostnameVerifier)
throws Throwable {
SslConfigurator sslConfig = SslConfigurator.newInstance()
.trustStoreFile(this.getClass().getResource("/truststore_client").getPath())
.trustStorePassword("asdfgh")
.keyStoreFile(this.getClass().getResource("/keystore_client").getPath())
.keyStorePassword("asdfgh");
SslConfigurator sslConfig = getSslConfigurator();

TransportFilter transportFilter = new TransportFilter(17_000, ThreadPoolConfig.defaultConfig(), 100_000);
final SSLParamConfigurator sslParamConfigurator = SSLParamConfigurator.builder()
Expand Down Expand Up @@ -481,6 +477,14 @@ void close() {
return clientSocket;
}

protected SslConfigurator getSslConfigurator() {
return SslConfigurator.newInstance()
.trustStoreFile(this.getClass().getResource("/truststore_client").getPath())
.trustStorePassword("asdfgh")
.keyStoreFile(this.getClass().getResource("/keystore_client").getPath())
.keyStorePassword("asdfgh");
}

/**
* SSL echo server. It expects a message to be terminated with \n.
*/
Expand Down

0 comments on commit e4c3bf5

Please sign in to comment.