You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bartolomeo Nicolotti <bn...@siapcn.it> on 2010/09/30 09:50:58 UTC

PreAuthentication with axis2

Hello,

we're using axis2 to generate a client to a webservice to which we've to
authenticate with user/pwd passing:

HttpTransportProperties.Authenticator
        auth = new HttpTransportProperties.Authenticator();
			 auth.setUsername(user);
			 auth.setPassword(pwd);
			 

options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);

The problem is that the generated client sends 2 http requests before to
get authenticated.

The first HTTP request we get unauthotized, the second is the same
except for this http header

Authorization: Basic ......

Is there a way to send this HTTP header in the first http request?
Something like PreAuthentication?

Many thanks

Best reagards

Bartolomeo



Re: PreAuthentication with axis2

Posted by Bartolomeo Nicolotti <bn...@siapcn.it>.
Hello,

found this:

http://hc.apache.org/httpclient-3.x/authentication.html#Preemptive_Authentication

which has solved the problemwith this code:

   		HttpTransportProperties.Authenticator
        auth = new HttpTransportProperties.Authenticator();
			 auth.setUsername(user);
			 auth.setPassword(pwd);
			 auth.setPreemptiveAuthentication(true);

Best regards

Bartolomeo

Il giorno gio, 30/09/2010 alle 09.50 +0200, Bartolomeo Nicolotti ha
scritto:
> Hello,
> 
> we're using axis2 to generate a client to a webservice to which we've
> to authenticate with user/pwd passing:
> 
> HttpTransportProperties.Authenticator
>         auth = new HttpTransportProperties.Authenticator();
> auth.setUsername(user);
> auth.setPassword(pwd);
> 
> options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,auth);
> 
> The problem is that the generated client sends 2 http requests before
> to get authenticated.
> 
> The first HTTP request we get unauthotized, the second is the same
> except for this http header
> 
> Authorization: Basic ......
> 
> Is there a way to send this HTTP header in the first http request?
> Something like PreAuthentication?
> 
> Many thanks
> 
> Best reagards
> 
> Bartolomeo 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org