Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-6055

Basic Auth credentials are missing in request

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.8.0
    • None
    • TCP transport
    • None

    Description

      There is a changed behaviour between Axis2 1.7 and Axis2 1.8 when using the preemptive authentication in the HttpTransportPropertiesImpl.Authenticator.

      In Axis2 1.7 following code was used to achive this behaviour:
       HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
       List<String> authpref = new ArrayList<>();
       authpref.add(AuthPolicy.BASIC);
       auth.setAuthSchemes(authpref);
       auth.setUsername("testUser");
       auth.setPassword("testUserPassword");
       auth.setPreemptiveAuthentication(true);
       msgContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth); //msgContext = org.apache.axis2.context.MessageContext

      Since Axis2 1.8 the code above does not work anymore, because org.apache.axis2.transport.http.HTTPAuthenticator.getPreemptiveAuthentication() is not called anymore by the AXIS implementation. Is this an intended behaviour or a bug? We are using at the moment Axis2 1.8.2.

      The current workaround for us is to set the header directly as shown in following example:
        List<NamedValue> l = new ArrayList<>();
       String credentials = "testUser:testUserPassword";
       l.add(new NamedValue(org.apache.axis2.kernel.http.HTTPConstants.HEADER_AUTHORIZATION, "Basic " + Base64.encode(credentials.getBytes())));
       msgContext.setProperty(org.apache.axis2.kernel.http.HTTPConstants.HTTP_HEADERS, l); //msgContext = org.apache.axis2.context.MessageContext

      Attachments

        Issue Links

          Activity

            People

              robertlazarski Robert Lazarski
              maexx84 Markus I.
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: