axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shantanu Sen <s...@pacbell.net>
Subject Re: Axis2 - how to set ServiceClient with http basic auth
Date Fri, 13 Jul 2007 21:18:47 GMT
I am using the following code but do not see any username/pw on the http request going out.
Do I need to configure any transport related property?


===
ServiceClient axisClient = new ServiceClient();
HttpTransportProperties.Authenticator authenticator = 
            (HttpTransportProperties.Authenticator)axisClient.getOptions().getProperty(HTTPConstants.AUTHENTICATE);
if (authenticator == null ) {
        authenticator = new HttpTransportProperties.Authenticator();
        axisClient.getOptions().setProperty( HTTPConstants.AUTHENTICATE, authenticator);
}
// commenting the following out does'nt help either.
authenticator.setRealm(HttpTransportProperties.Authenticator.BASIC);

authenticator.setUsername("test_user");
authenticator.setPassword("test_password");
===

I see that in AbstractHTTPSender, the following code on lines 398 - 402 (Axis2-1.2.1 src)
are getting executed with the correct username/pw that I supplied:

--- AbstractHTTSender---
...
                     else {
                        /*Credentials only for Digest and Basic Authentication*/
                        creds = new UsernamePasswordCredentials(username, password);
                        agent.getState().setCredentials(new AuthScope(AuthScope.ANY), creds);
                    }

---

But when I look at the request using tcpmon I do not see the username/pw. I see other http
specific parameters such as cookie etc correctly set.

Any ideas?

Thanks,
Shantanu

----- Original Message ----
From: Dimuthu <muthulee@apache.org>
To: axis-user@ws.apache.org
Sent: Wednesday, July 11, 2007 8:47:51 PM
Subject: Re: Axis2 - how to set ServiceClient with  http basic auth

Hi,

HttpTransportProperties.Authenticator auth =                new
HttpTransportProperties.Authenticator();
String username = "user"; 
String passwd = "pass";
auth.setUsername(username);
auth.setPassword(passwd);
// un-comment the  below line if you are sending authentication details 
// without receiving 401 Authentication Required
//auth.setPreemptiveAuthentication(true);
options.setProperty(HTTPConstants.AUTHENTICATE,auth);

Regards,
Dimuthu


On Wed, 2007-07-11 at 16:49 -0700, Shantanu Sen wrote:
> The article at http://wso2.org/library/161 seems obsolete.There is no HttpTransportProperties.BasicAuthentication
in the current Axis2-1.2 codebase. Can this article be updated?
> 
> Is the basic and ntlm authentication unified so that we just need to use HttpTransportProperties.Authenticator?

> 
> Is the property name to be used HttpConstatns.AUTHENTICATE?
> 
> Thanks for any help.
> Shantanu Sen
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 


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





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


Mime
View raw message