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 esu2 <jo...@hotmail.com> on 2009/03/14 21:28:15 UTC

authentication fail, how do I get redirect URL?

Hi 
I'm using HTTPClient to access a single sign on page. I post request to
login form with wrong password, I got http response status = 401
(authentication fail). I think this make sense.

However, I do the same thing in Firefox and watch the headers, above request
result in 302 response and redirect to a "login fail" page.

My question is how to mimic this behivior in HTTPClient. in HTTPClient, I
don't get 302. therefore, I'm not able to get the URL of "login fail" page.

-- 
View this message in context: http://www.nabble.com/authentication-fail%2C-how-do-I-get-redirect-URL--tp22516724p22516724.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: authentication fail, how do I get redirect URL?

Posted by Sam Crawford <sa...@gmail.com>.
Could the OP have enabled NTLM and/or Kerberos auth in the browser, and not
in HttpClient? This would explain the 401 (as it'd be sent back in
conjunction with a WWW-Authenticate: Negotiate etc)

Thanks,

Sam


2009/3/15 Oleg Kalnichevski <ol...@apache.org>

> esu2 wrote:
>
>> Thank you. no luck. I compared the wire log and firefox, no difference.
>> Browser always return 302 but HTTPClient return 401
>>
>>
> I think the only rational explanation is that the server was taken over by
> green men from Mars. I cannot help with extraterrestrials.
>
> Oleg
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: authentication fail, how do I get redirect URL?

Posted by Oleg Kalnichevski <ol...@apache.org>.
esu2 wrote:
> Thank you. 
> no luck. I compared the wire log and firefox, no difference.
> Browser always return 302 but HTTPClient return 401
>

I think the only rational explanation is that the server was taken over 
by green men from Mars. I cannot help with extraterrestrials.

Oleg




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


Re: authentication fail, how do I get redirect URL?

Posted by esu2 <jo...@hotmail.com>.
Thank you. 
no luck. I compared the wire log and firefox, no difference.
Browser always return 302 but HTTPClient return 401
any parameter in HTTPClient could affect this?
-- 
View this message in context: http://www.nabble.com/authentication-fail%2C-how-do-I-get-redirect-URL--tp22516724p22523983.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: authentication fail, how do I get redirect URL?

Posted by Oleg Kalnichevski <ol...@apache.org>.
esu2 wrote:
> Thank you.
> Unfortunatly, this is a HTTPS site (pass user name/password). How do I
> capture sent packet?
> 
> Anyone see the similar problem?
> 
> 

Use a plugin such as HttpFox [1] to capture HTTP packets on the browser 
side, and the wire logging on the HttpClient side

[1] https://addons.mozilla.org/en-US/firefox/addon/6647
[2] http://hc.apache.org/httpclient-3.x/logging.html

Oleg

> 
> olegk wrote:
>> On Sat, 2009-03-14 at 13:28 -0700, esu2 wrote:
>>> Hi 
>>> I'm using HTTPClient to access a single sign on page. I post request to
>>> login form with wrong password, I got http response status = 401
>>> (authentication fail). I think this make sense.
>>>
>>> However, I do the same thing in Firefox and watch the headers, above
>>> request
>>> result in 302 response and redirect to a "login fail" page.
>>>
>>> My question is how to mimic this behivior in HTTPClient. in HTTPClient, I
>>> don't get 302. therefore, I'm not able to get the URL of "login fail"
>>> page.
>>>
>> Capture HTTP packets generated by the browser, find the difference with
>> those produced by HttpClient, tweak your code to make HttpClient produce
>> exact / compatible packets.
>>
>> Oleg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>>
> 


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


Re: authentication fail, how do I get redirect URL?

Posted by esu2 <jo...@hotmail.com>.
Thank you.
Unfortunatly, this is a HTTPS site (pass user name/password). How do I
capture sent packet?

Anyone see the similar problem?



olegk wrote:
> 
> On Sat, 2009-03-14 at 13:28 -0700, esu2 wrote:
>> Hi 
>> I'm using HTTPClient to access a single sign on page. I post request to
>> login form with wrong password, I got http response status = 401
>> (authentication fail). I think this make sense.
>> 
>> However, I do the same thing in Firefox and watch the headers, above
>> request
>> result in 302 response and redirect to a "login fail" page.
>> 
>> My question is how to mimic this behivior in HTTPClient. in HTTPClient, I
>> don't get 302. therefore, I'm not able to get the URL of "login fail"
>> page.
>> 
> 
> Capture HTTP packets generated by the browser, find the difference with
> those produced by HttpClient, tweak your code to make HttpClient produce
> exact / compatible packets.
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/authentication-fail%2C-how-do-I-get-redirect-URL--tp22516724p22523157.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: authentication fail, how do I get redirect URL?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2009-03-14 at 13:28 -0700, esu2 wrote:
> Hi 
> I'm using HTTPClient to access a single sign on page. I post request to
> login form with wrong password, I got http response status = 401
> (authentication fail). I think this make sense.
> 
> However, I do the same thing in Firefox and watch the headers, above request
> result in 302 response and redirect to a "login fail" page.
> 
> My question is how to mimic this behivior in HTTPClient. in HTTPClient, I
> don't get 302. therefore, I'm not able to get the URL of "login fail" page.
> 

Capture HTTP packets generated by the browser, find the difference with
those produced by HttpClient, tweak your code to make HttpClient produce
exact / compatible packets.

Oleg


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