Thanks Oleg,
Works like a charm. I noticed that if I leave the scheme preferences alone it 
tries to authenticate with NTLM then falls back to basic anyway. I don't 
remember HttpClient 3.x doing this, is this new in HttpClient?

cheers,
Nick

-----Original Message-----
From: Oleg Kalnichevski [mailto:[email protected]] 
Sent: Thursday, October 28, 2010 10:50 AM
To: HttpClient User Discussion
Subject: Re: how to force basic scheme authentication using HttpClient 4.0.2

On Wed, 2010-10-27 at 19:53 -0500, Mills, Nick wrote:
> I don't want to authenticate with the proxy using NTLM v2 (because it's not 
> supported).
> So is there a way to force basic authentication in 4.0.2?
> 
> I'm stuck with the 4.0.2 version because I'm using WebDriver 2.0a6.
> 
> For older 3.x HttpClients we could do:
> 
> HttpClient client = new HttpClient();
> List authPrefs = new ArrayList(2);
> authPrefs.add(AuthPolicy.DIGEST);
> authPrefs.add(AuthPolicy.BASIC);
> // This will exclude the NTLM authentication scheme
> client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
> 
> Am I able to do something similar with 4.0.2?
> 

Yes, you can

With HttpClient 4.0.x one can override the
AbstractAuthenticationHandler#getAuthPreferences() method in order to
return a different sequence of preferred auth schemes

With HttpClient 4.1-alpha-x one can also use
'http.auth.proxy-scheme-perf' and 'http.auth.target-scheme-perf'
parameters to set a particular sequence of preferred auth schemes for
proxy and target authentication respectively.

Please also note HttpClient 4.1 HEAD (to be released as 4.1-beta1 soon)
fully supports NTLMv1 and NTLMv2 auth schemes out of the box

Hope this help

Oleg 

> Thanks,
> Nick Mills



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to