hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Tay <justin.tay...@gmail.com>
Subject Proxy Authentication
Date Mon, 04 Aug 2008 15:02:22 GMT


I would like to do the following regarding proxy authentication.

1) Pre-emptive authentication for proxies that have issued a challenge
before. (The idea being that a proxy that has requested for authentication
before will probably still ask for authentication)
2) Allow the handling of failed authentication requests due to incorrect
credentials. (The use case is similar to what happens when the proxy
credentials are wrong in a browser, it will prompt the user for a username
and password and try to authenticate with the proxy again)

For (1) followed the sample that implements HttpRequestInterceptor and was
able to meet the requirement by implementing HttpResponseInterceptor and
storing the HttpHost of the proxy and AuthScheme into a map to be retrieved
later. (BasicScheme only knows it's handling a proxy after a call to
processChallenge). This works fine when connecting to http targets. 

However I would also like this behaviour to apply when connecting to https
targets. I notice that this is done in
DefaultRequestDirector.createTunnelToTarget() and doesn't involve the
calling of any interceptors. In any case the execution context isn't
populated till later.

Is there any way to achieve this without extending DefaultRequestDirector?

For (2) is it possible to add one more method to the AuthenticationHandler
like handleAuthenticationFailure? My only other alternative seems to be
extending DefaultRequestDirector and overriding the updateAuthState method.
I think it's best if in additional to the proxyAuthHandler, the
targetAuthHandler can also use this to prompt the user for credentials again
if the user gets it wrong.

Justin Tay
View this message in context: http://www.nabble.com/Proxy-Authentication-tp18813008p18813008.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

View raw message