You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Frank Olschewski (JIRA)" <ji...@apache.org> on 2018/07/11 14:06:00 UTC

[jira] [Created] (CAMEL-12642) No support for http4 feature authenticationPreemptive in pollEnrich

Frank Olschewski created CAMEL-12642:
----------------------------------------

             Summary: No support for http4 feature authenticationPreemptive in pollEnrich
                 Key: CAMEL-12642
                 URL: https://issues.apache.org/jira/browse/CAMEL-12642
             Project: Camel
          Issue Type: Bug
          Components: camel-http4
    Affects Versions: 2.23.0
            Reporter: Frank Olschewski


authenticationPreemptive=true does not work with pollEnrich.
{code:java}
.pollEnrich("https4:localhost?authenticationPreemptive=true" +
   "&authUsername=user&authPassword=passwd"){code}
In Class /org/apache/camel/component/http4/HttpPollingConsumer.java:79 you see the following code:
{code:java}
HttpResponse response = httpClient.execute(method, httpClientContext);{code}
The setup for authenticationPreemptive is missing.

You can see what to do in org.apache.camel.component.http4.HttpProducer#executeMethod:
{code:java}
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);
}{code}
 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)