You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by no...@gmx.de on 2005/01/24 15:43:32 UTC

httpclient does not work for https via user/ password

hi

i just started working with the httpclient... everything worked fine until i
tried to execute a "GetMethod" via https and user/ password
authentication... this one doesn't. :(

what properties do i have to change? i guess, there are different
possibilities to use AuthScope... but what is the right one? manually (via
browser), the login works with the applied parameters...

>>>
        HttpClient client = new HttpClient();
    
        client.getState().setCredentials(
            new AuthScope("www.someurl.com/sub", 443, "realm"),
            new UsernamePasswordCredentials("user", "password")
        );
    
        GetMethod get = new GetMethod("https://www.someurl.com/sub");
    
        get.setDoAuthentication( true );
<<<

thanks + cheers 

christian

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


Re: httpclient does not work for https via user/ password

Posted by Christian Neuroth <no...@gmx.de>.
hi

that was it.. thanks a lot

cheers

christian

> On Mon, Jan 24, 2005 at 04:51:59PM +0100, Christian Neuroth wrote:
> > hi
> > 
> > thanks for the reply...
> > 
> > i am still not able to log me into the page. however, the following
> > stacktrace occurs. if those credentials could not be used... what should
> i
> > use?
> > 
> > >>>
> > SCHWERWIEGEND: Credentials cannot be used for NTLM authentication:
> > org.apache.commons.httpclient.UsernamePasswordCredentials
> > org.apache.commons.httpclient.auth.InvalidCredentialsException:
> Credentials
> > cannot be used for NTLM authentication:
> > org.apache.commons.httpclient.UsernamePasswordCredentials
> > 	at
> >
>
org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:331)
> > 	at
> >
>
org.apache.commons.httpclient.HttpMethodDirector.authenticateHost(HttpMethodDirector.java:276)
> > 	at
> >
>
org.apache.commons.httpclient.HttpMethodDirector.authenticate(HttpMethodDirector.java:228)
> > 	at
> >
>
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:167)
> > 	at
> >
>
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:393)
> > 	at
> >
>
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
> > 	at TestClient.testHot(TestClient.java:83)
> > 	at TestClient.main(TestClient.java:20)
> > 24.01.2005 16:48:00 org.apache.commons.httpclient.HttpMethodDirector
> > processWWWAuthChallenge
> > <<<
> 
> This basically means that you have got to use NTCredentials instead of
> plain-vanilla UsernamePasswordCredentials, because NTLM authentication
> scheme also requires the authentication domain to be specified.
> 
> For details see
> http://jakarta.apache.org/commons/httpclient/3.0/authentication.html
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 

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


Re: httpclient does not work for https via user/ password

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Jan 24, 2005 at 04:51:59PM +0100, Christian Neuroth wrote:
> hi
> 
> thanks for the reply...
> 
> i am still not able to log me into the page. however, the following
> stacktrace occurs. if those credentials could not be used... what should i
> use?
> 
> >>>
> SCHWERWIEGEND: Credentials cannot be used for NTLM authentication:
> org.apache.commons.httpclient.UsernamePasswordCredentials
> org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials
> cannot be used for NTLM authentication:
> org.apache.commons.httpclient.UsernamePasswordCredentials
> 	at
> org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:331)
> 	at
> org.apache.commons.httpclient.HttpMethodDirector.authenticateHost(HttpMethodDirector.java:276)
> 	at
> org.apache.commons.httpclient.HttpMethodDirector.authenticate(HttpMethodDirector.java:228)
> 	at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:167)
> 	at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:393)
> 	at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
> 	at TestClient.testHot(TestClient.java:83)
> 	at TestClient.main(TestClient.java:20)
> 24.01.2005 16:48:00 org.apache.commons.httpclient.HttpMethodDirector
> processWWWAuthChallenge
> <<<

This basically means that you have got to use NTCredentials instead of
plain-vanilla UsernamePasswordCredentials, because NTLM authentication
scheme also requires the authentication domain to be specified.

For details see
http://jakarta.apache.org/commons/httpclient/3.0/authentication.html

Oleg


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


Re: httpclient does not work for https via user/ password

Posted by Christian Neuroth <no...@gmx.de>.
hi

thanks for the reply...

i am still not able to log me into the page. however, the following
stacktrace occurs. if those credentials could not be used... what should i
use?

>>>
SCHWERWIEGEND: Credentials cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredentials
org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials
cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredentials
	at
org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:331)
	at
org.apache.commons.httpclient.HttpMethodDirector.authenticateHost(HttpMethodDirector.java:276)
	at
org.apache.commons.httpclient.HttpMethodDirector.authenticate(HttpMethodDirector.java:228)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:167)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:393)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
	at TestClient.testHot(TestClient.java:83)
	at TestClient.main(TestClient.java:20)
24.01.2005 16:48:00 org.apache.commons.httpclient.HttpMethodDirector
processWWWAuthChallenge
<<<

cheers

christian

> On Mon, Jan 24, 2005 at 03:43:32PM +0100, nollario@gmx.de wrote:
> > hi
> > 
> > i just started working with the httpclient... everything worked fine
> until i
> > tried to execute a "GetMethod" via https and user/ password
> > authentication... this one doesn't. :(
> > 
> > what properties do i have to change? i guess, there are different
> > possibilities to use AuthScope... but what is the right one? manually
> (via
> > browser), the login works with the applied parameters...
> > 
> > >>>
> >         HttpClient client = new HttpClient();
> >     
> >         client.getState().setCredentials(
> >             new AuthScope("www.someurl.com/sub", 443, "realm"),
> >             new UsernamePasswordCredentials("user", "password")
> >         );
> >     
> >         GetMethod get = new GetMethod("https://www.someurl.com/sub");
> >     
> >         get.setDoAuthentication( true );
> > <<<
> >
> 
> Hi Christian,
> 
> Try the following authentication scope instead: 
> 
>  new AuthScope("www.someurl.com", 443, "realm"),
> 
> You may also want to activate the wire/context logging to get more
> details about the method's execution:
> 
> http://jakarta.apache.org/commons/httpclient/3.0/logging.html
> 
> Hope this helps
> 
> Oleg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 

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


Re: httpclient does not work for https via user/ password

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Jan 24, 2005 at 03:43:32PM +0100, nollario@gmx.de wrote:
> hi
> 
> i just started working with the httpclient... everything worked fine until i
> tried to execute a "GetMethod" via https and user/ password
> authentication... this one doesn't. :(
> 
> what properties do i have to change? i guess, there are different
> possibilities to use AuthScope... but what is the right one? manually (via
> browser), the login works with the applied parameters...
> 
> >>>
>         HttpClient client = new HttpClient();
>     
>         client.getState().setCredentials(
>             new AuthScope("www.someurl.com/sub", 443, "realm"),
>             new UsernamePasswordCredentials("user", "password")
>         );
>     
>         GetMethod get = new GetMethod("https://www.someurl.com/sub");
>     
>         get.setDoAuthentication( true );
> <<<
>

Hi Christian,

Try the following authentication scope instead: 

 new AuthScope("www.someurl.com", 443, "realm"),

You may also want to activate the wire/context logging to get more
details about the method's execution:

http://jakarta.apache.org/commons/httpclient/3.0/logging.html

Hope this helps

Oleg



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