hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [httpclient] NTLM scheme authentication: Credentials not found
Date Wed, 08 Sep 2010 13:14:48 GMT
On Wed, 2010-09-08 at 12:03 +0200, MASTRELLA STEFANO wrote:
> I'd like to goggle around via the httpclient library through a proxy
> with a NTLM authentication scheme, so I've just copied the example in
> 

...

> The configuration of the HttpClient is as in the following
> 
> public class HttpTest
> {
>   public void doGoogling() throws ClientProtocolException, IOException
>   {
>     BasicConfigurator.configure();
> 
>     DefaultHttpClient httpclient = new DefaultHttpClient();
> 
>     httpclient.getAuthSchemes().register("ntlm", new
> NTLMSchemeFactory());
> 
>     /*
>      * Proxy configuration
>      */
>     HttpHost proxy = new HttpHost("myproxy.it", 8080);
>     httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
> proxy);
> 
>     /*
>      * credentials: the username and the workstation are the same
> because
>      * the program run from the user owner of the workstation
>      */
>     NTCredentials creds = new NTCredentials("myusername", "mypassw",
> "myusername", "mydomain");
>     AuthScope scope = new AuthScope("google.com", AuthScope.ANY_PORT);
>
>     httpclient.getCredentialsProvider().setCredentials(scope, creds);
> 

Auth scope is wrong. The host name should be that of the proxy not of
the target. 

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message