Skip to content

Commit 1f1b36c

Browse files
committed
preserve custom SSLContext when quarkus.tls.trust-all=true
1 parent 7b569c6 commit 1f1b36c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ private void configureTrustAll(ResteasyClientBuilder clientBuilder) {
385385
if (trustAll.isPresent() && trustAll.get()) {
386386
clientBuilder.hostnameVerifier(new NoopHostnameVerifier());
387387
try {
388-
SSLContext sslContext = SSLContext.getInstance("TLS");
389-
sslContext.init(null, new TrustManager[] { new PassthroughTrustManager() },
390-
new SecureRandom());
391-
clientBuilder.sslContext(sslContext);
388+
if (this.sslContext == null) {
389+
SSLContext sslContext = SSLContext.getInstance("TLS");
390+
sslContext.init(null, new TrustManager[] { new PassthroughTrustManager() },
391+
new SecureRandom());
392+
clientBuilder.sslContext(sslContext);
393+
}
392394
} catch (NoSuchAlgorithmException | KeyManagementException e) {
393395
throw new RuntimeException("Failed to initialized SSL context", e);
394396
}

0 commit comments

Comments
 (0)