From a0320b9505073357bbd085e5ee4a4894ecd1e9f3 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 6 Feb 2023 15:04:35 +0100 Subject: feat(http): add request interceptor to pre-emptive HTTP Basic authentication --- .../java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java') diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java index 784dbe0e..ac5905ac 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/http/HttpClientFactory.java @@ -49,6 +49,7 @@ import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.impl.credential.EaafKeyStoreFactory; import at.gv.egiz.eaaf.core.impl.credential.KeyStoreConfiguration.KeyStoreType; import at.gv.egiz.eaaf.core.impl.data.Pair; +import at.gv.egiz.eaaf.core.impl.http.interceptor.PreemptiveAuthInterceptor; import lombok.extern.slf4j.Slf4j; @Slf4j @@ -305,6 +306,13 @@ public class HttpClientFactory implements IHttpClientFactory { log.info("Basic http authentication was injected with username: {}", httpClientConfig.getUsername()); + if (httpClientConfig.isEnablePreEmptiveHttpBasicAuth()) { + log.info("Inject pre-emptive HTTP Basic-Auth interceptor for client: {}", + httpClientConfig.getFriendlyName()); + builder.addInterceptorFirst(new PreemptiveAuthInterceptor()); + + } + } else { log.trace("Injection of Http Basic authentication was skipped"); -- cgit v1.2.3