Skip to content
Open
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
Expand Up @@ -49,6 +49,7 @@
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;

import org.apache.cxf.transport.https.httpclient.DefaultHostnameVerifier;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.talend.sdk.components.vault.configuration.Documentation;

Expand Down Expand Up @@ -190,14 +191,15 @@ private ClientBuilder createClient(final ExecutorService executor, final Optiona
final Optional<String> keystoreType, final String keystorePassword, final Optional<String> truststoreType,
final List<String> serverHostnames) {
final ClientBuilder builder = ClientBuilder.newBuilder();
final DefaultHostnameVerifier hostnameVerifier = new DefaultHostnameVerifier();
builder.connectTimeout(connectTimeout, MILLISECONDS);
builder.readTimeout(readTimeout, MILLISECONDS);
builder.executorService(executor);
if (acceptAnyCertificate) {
builder.hostnameVerifier((host, session) -> true);
builder.sslContext(createUnsafeSSLContext());
} else if (keystoreLocation.isPresent()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if keystore is present or not, or, simply raise an exception when it is not present ? (maybe a question to @coheigea )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the code falls back to the JDK defaults if the keystore isn't present? If so that would be OK, and we could just log this.

builder.hostnameVerifier((host, session) -> serverHostnames.contains(host));
builder.hostnameVerifier(hostnameVerifier);
builder.sslContext(createSSLContext(keystoreLocation, keystoreType, keystorePassword, truststoreType));
}
providers.map(it -> Stream.of(it.split(",")).map(String::trim).filter(v -> !v.isEmpty()).map(fqn -> {
Expand Down
Loading