diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/QuarkusRestClientBuilder.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/QuarkusRestClientBuilder.java index 7e41aec082120..d6563019c8bc1 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/QuarkusRestClientBuilder.java +++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/QuarkusRestClientBuilder.java @@ -274,6 +274,11 @@ static QuarkusRestClientBuilder newBuilder() { */ QuarkusRestClientBuilder loggingBodyLimit(Integer limit); + /** + * Enable trusting all certificates. Disable by default. + */ + QuarkusRestClientBuilder trustAll(boolean trustAll); + /** * Based on the configured QuarkusRestClientBuilder, creates a new instance of the given REST interface to invoke API calls * against. diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/QuarkusRestClientBuilderImpl.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/QuarkusRestClientBuilderImpl.java index 0a9c481e7a113..87424d184edd0 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/QuarkusRestClientBuilderImpl.java +++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/QuarkusRestClientBuilderImpl.java @@ -237,6 +237,12 @@ public QuarkusRestClientBuilder loggingBodyLimit(Integer limit) { return this; } + @Override + public QuarkusRestClientBuilder trustAll(boolean trustAll) { + proxy.trustAll(trustAll); + return this; + } + @Override public T build(Class clazz) throws IllegalStateException, RestClientDefinitionException { return proxy.build(clazz); diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java index b33c23918ac72..6293d6155e1ad 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java +++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientBuilderImpl.java @@ -73,6 +73,8 @@ public class RestClientBuilderImpl implements RestClientBuilder { private LoggingScope loggingScope; private Integer loggingBodyLimit; + private Boolean trustAll; + @Override public RestClientBuilderImpl baseUrl(URL url) { try { @@ -179,6 +181,11 @@ public RestClientBuilderImpl loggingBodyLimit(Integer limit) { return this; } + public RestClientBuilderImpl trustAll(boolean trustAll) { + this.trustAll = trustAll; + return this; + } + @Override public RestClientBuilderImpl executorService(ExecutorService executor) { throw new IllegalArgumentException("Specifying executor service is not supported. " + @@ -370,10 +377,13 @@ public T build(Class aClass) throws IllegalStateException, RestClientDefi clientBuilder.multiQueryParamMode(toMultiQueryParamMode(queryParamStyle)); - Boolean trustAll = ConfigProvider.getConfig().getOptionalValue(TLS_TRUST_ALL, Boolean.class) - .orElse(false); + Boolean effectiveTrustAll = trustAll; + if (effectiveTrustAll == null) { + effectiveTrustAll = ConfigProvider.getConfig().getOptionalValue(TLS_TRUST_ALL, Boolean.class) + .orElse(false); + } - clientBuilder.trustAll(trustAll); + clientBuilder.trustAll(effectiveTrustAll); restClientsConfig.verifyHost.ifPresent(clientBuilder::verifyHost); String userAgent = (String) getConfiguration().getProperty(QuarkusRestClientProperties.USER_AGENT); @@ -452,5 +462,4 @@ private MultiQueryParamMode toMultiQueryParamMode(QueryParamStyle queryParamStyl } return null; } - }