Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.23.0
-
None
-
Unknown
Description
authenticationPreemptive=true does not work with pollEnrich.
.pollEnrich("https4:localhost?authenticationPreemptive=true" + "&authUsername=user&authPassword=passwd")
In Class /org/apache/camel/component/http4/HttpPollingConsumer.java:79 you see the following code:
HttpResponse response = httpClient.execute(method, httpClientContext);
The setup for authenticationPreemptive is missing.
You can see what to do in org.apache.camel.component.http4.HttpProducer#executeMethod:
pprotected HttpResponse executeMethod(HttpUriRequest httpRequest) throws IOException { HttpContext localContext = new BasicHttpContext(); if (getEndpoint().isAuthenticationPreemptive()) { BasicScheme basicAuth = new BasicScheme(); localContext.setAttribute("preemptive-auth", basicAuth); } if (httpContext != null) { localContext = new BasicHttpContext(httpContext); } return httpClient.execute(httpRequest, localContext); }
In org.apache.camel.component.http4.HttpPollingConsumer#doReceive getEndpoint().isAuthenticationPreemptive() returns the correct value, so there is nothing against implementing this feature here as well.
The problem behind the scene ist that the context attribute "preemptive-auth" is missing.