Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-12642

No support for http4 feature authenticationPreemptive in pollEnrich

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.23.0
    • 2.23.0
    • camel-http4
    • 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.

      Attachments

        Activity

          People

            ramu11 Ramu
            folschewski Frank Olschewski
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: