This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.10.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.10.x by this push:
new 0ae3f5f2b61 camel-http - NTLM authentication doesn't work over http
(#18170)
0ae3f5f2b61 is described below
commit 0ae3f5f2b61ba4c165aeda77ab8e6e103b85425d
Author: Bruno Gonçalves <[email protected]>
AuthorDate: Sat May 24 07:29:00 2025 +0100
camel-http - NTLM authentication doesn't work over http (#18170)
Set NTLM as preferred scheme
---
.../http/BasicAuthenticationHttpClientConfigurer.java | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git
a/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java
b/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java
index 7c356dce35e..e89d20231a8 100644
---
a/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java
+++
b/components/camel-http/src/main/java/org/apache/camel/component/http/BasicAuthenticationHttpClientConfigurer.java
@@ -21,6 +21,7 @@ import org.apache.hc.client5.http.auth.Credentials;
import org.apache.hc.client5.http.auth.NTCredentials;
import org.apache.hc.client5.http.auth.StandardAuthScheme;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
+import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.auth.BasicSchemeFactory;
import org.apache.hc.client5.http.impl.auth.BearerSchemeFactory;
import org.apache.hc.client5.http.impl.auth.DigestSchemeFactory;
@@ -28,6 +29,8 @@ import org.apache.hc.client5.http.impl.auth.NTLMSchemeFactory;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.config.RegistryBuilder;
+import java.util.List;
+
public class BasicAuthenticationHttpClientConfigurer implements
HttpClientConfigurer {
private final String username;
private final char[] password;
@@ -56,7 +59,15 @@ public class BasicAuthenticationHttpClientConfigurer
implements HttpClientConfig
.register(StandardAuthScheme.BEARER,
BearerSchemeFactory.INSTANCE)
.register(StandardAuthScheme.NTLM,
NTLMSchemeFactory.INSTANCE)
.build();
- clientBuilder.setDefaultAuthSchemeRegistry(copy);
+
+ // Set NTLM as preferred scheme
+ RequestConfig requestConfig = RequestConfig.custom()
+
.setTargetPreferredAuthSchemes(List.of(StandardAuthScheme.NTLM))
+ .build();
+
+ clientBuilder
+ .setDefaultAuthSchemeRegistry(copy)
+ .setDefaultRequestConfig(requestConfig);
} else {
defaultcreds = new UsernamePasswordCredentials(username, password);
}