hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weber" <ROLWE...@de.ibm.com>
Subject Re: Make HttpClient pick Basic Auth over NTLM?
Date Thu, 04 Dec 2003 07:09:51 GMT
Hello,

try client.getState().setAuthenticationPreemptive(true);

I'm not sure whether HTTP Client evaluates this flag for
proxy and target server, or just for the target server. In
the first case, it should have the desired effect.

My guess is that when HTTP Client has the choice
between Basic and NTLM Auth, it picks NTLM. By
enabling preemptive authentication, it has to choose
Basic because that's the only thing for which there
are credentials.

regards,
  Roland






"anon permutation" <anonpermutation@hotmail.com>
04.12.2003 06:16
Please respond to "Commons HttpClient Project"
 
        To:     commons-httpclient-dev@jakarta.apache.org
        cc: 
        Subject:        Make HttpClient pick Basic Auth over NTLM?



Hi,

I am using a proxy server that supports both NTLM and Basic 
Authentications. 
  How do I make HttpClient use Basic Auth. instead of NTLM?  I am using 
2.0-rc2.  Following is my code:

--------------------------------------------------------------------------------------------------------------------
HttpClient client = new HttpClient();
HttpMethod method = null;

client.getState().setProxyCredentials(null, new 
UsernamePasswordCredentials("user","passwd"));

HostConfiguration hc = client.getHostConfiguration();
hc.setProxy("10.0.0.2", 80);

method = new GetMethod(url);
client.executeMethod(method);
byte[] responseBody = method.getResponseBody();
-----------------------------------------------------------------------------------------------------------------

I am getting this error:
Credentials cannot be used for NTLM authentication


Thanks.

_________________________________________________________________
Browse styles for all ages, from the latest looks to cozy weekend wear at 
MSN Shopping.  And check out the beauty products! http://shopping.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: 
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: 
commons-httpclient-dev-help@jakarta.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message