I am attempting to configure preemptive authentication for an Axis2 client.
From my research, it seems like the code below should work, but in tcpmon I am
still seeing pairs of unauthenticated requests followed by digest requests. I
did find information on populating an authentication data cache for preemptive
authentication
(http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html)
but this seems to be based on the org.apache.http.client components, not the
org.apache.commons.httpclient that is used by Axis2. I would also assume that
Axis2 is doing this for us?
Does anyone know how to make this work? The service stub in the following code
was generated by Axis2 wsdl2java
HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();
authenticator.setUsername(getUserName());
authenticator.setPassword(getPassword());
authenticator.setAuthSchemes(Arrays.asList(new
String[]{HttpTransportProperties.Authenticator.DIGEST}));
authenticator.setPreemptiveAuthentication(true);
Options options = serviceStub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 72000);
options.setProperty(HTTPConstants.SO_TIMEOUT, 72000);
options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
________________________________
STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain confidential or privileged information. If you are not the intended
recipient, please notify WHI Solutions immediately at [email protected],
and destroy all copies of this message and any attachments.