Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add URL of KeyStore and TrustStore to SslConfigurator #5511

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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");
}
}
Original file line number Diff line number Diff line change
@@ -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
Loading