Hi ,

We are facing problem in NTLM authentication while using HTTP Client version 
4.1.1 version ( we tried with 4.2.5 as well same problem). We are getting 
following exception while connect in NTLM proxy authentication environment:

org.apache.http.client.protocol.RequestProxyAuthentication - Proxy 
authentication error: Credentials cannot be used for NTLM authentication: ( 
With Status Code : 407)

We had written following way the code :

           httpClient.getCredentialsProvider().setCredentials(new 
AuthScope(iptext, Integer.parseInt(porttext)),
                    new UsernamePasswordCredentials(unametext, passtext));
After that we tried as mentioned in below link which also does not work:

http://hc.apache.org/httpcomponents-client-ga/ntlm.html

Then we thought of by passing NTLM authentication as mentioned below :

            List<String> authpref = new ArrayList<String>();
            authpref.add(AuthPolicy.BASIC);
            authpref.add(AuthPolicy.DIGEST);
            httpClient.getParams().setParameter(AuthPNames.PROXY_AUTH_PREF, 
authpref);

Again bad luck. And Java's URLConnection works well with NTLM without any 
issues so we are wondering what is something missing in HTTP Client or the way 
we are using.

Please suggest what could be the solution ASAP.

Best Regards,

Sumit Kumar
Software Architect

eRevMax Technologies Pvt. Ltd.
Phone: +91 (0) 80 416 84 990| Mobile: +91 (0) 9741622116 | Skype: sumitkjm
Email: [email protected]<mailto:[email protected]> | Web: 
www.erevmax.com<http://www.erevmax.com>

Reply via email to