Skip to content
Merged
Changes from 4 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,15 +191,20 @@ 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()) {
builder.hostnameVerifier((host, session) -> serverHostnames.contains(host));
builder.sslContext(createSSLContext(keystoreLocation, keystoreType, keystorePassword, truststoreType));
} else {
if (keystoreLocation.isPresent()) {
builder.hostnameVerifier(hostnameVerifier);
builder.sslContext(createSSLContext(keystoreLocation, keystoreType, keystorePassword, truststoreType));
} else {
log.warn("Key store location is NOT present. ");
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it is an issue to not have the keystore location defined. If not the default java certificate management will be used.
So maybe just :
log.info("TCK vault-client doesn't explicitly define the keystore location. You can use 'talend.vault.cache.client.vault.certificate.keystore.location' and 'talend.vault.cache.client.vault.certificate.keystore.type' to explicit it.")

or something like this...

}
}
providers.map(it -> Stream.of(it.split(",")).map(String::trim).filter(v -> !v.isEmpty()).map(fqn -> {
try {
Expand Down
Loading