Friday, August 21, 2009

How to enable NTLM authentication in Axis2 client?


HttpTransportProperties.NTLMAuthentication ntlmAuthentication = new HttpTransportProperties().new NTLMAuthentication();
ntlmAuthentication.setUsername("axis2");
ntlmAuthentication.setPassword("axis2");
ntlmAuthentication.setHost("axis2");
ntlmAuthentication.setPort(9443);
ntlmAuthentication.setRealm("someRealm");
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.NTLM_AUTHENTICATION,ntlmAuthentication);

3 comments:

hendry

Prabath,

In axis2 1.5 there is no HttpConstant NTLM_AUTHENTICATION

Prabath Siriwardena

Yes - true.

If we want to do NTLM, Digest or Basic Auth need to fill the Authenticator bean and set it with this property. Httpclient will internally handles whether to use NTLM, Digest or Basic Auth.

HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
auth.add(authenticator.NTLM);

Prabath Siriwardena

Related thread on Axis2

http://mail-archives.apache.org/mod_mbox/ws-axis-user/200908.mbox/%3C4A915457.4050106@wso2.com%3E

Post a Comment