Package ucar.httpservices
Class HTTPAuthCache
- java.lang.Object
-
- org.apache.http.impl.client.BasicAuthCache
-
- ucar.httpservices.HTTPAuthCache
-
- All Implemented Interfaces:
org.apache.http.client.AuthCache
@ThreadSafe public class HTTPAuthCache extends org.apache.http.impl.client.BasicAuthCache
It turns out that the Apache httpclient code is not well setup to handle dynamic credentials providers such as UrlAuthenticatorDialog. These providers will ask the user on the fly to provide a set of credentials (typically username+pwd). The provider can be set up to cache credentials (again see UrlAuthenticatorDialog), but in the event that the user gives bad credentials, the provider cache clear function does not get called by AuthCache. So, as a work-around, we use our own implementation of BasicAuthCache that stores a list of credentials providers and when the AuthCache.remove function is called, it forwards it to the either the clear() function of the provider, or, if it is an instance of HTTPCredentialsProvider, it will call the remove function to provide finer-grain control. This is an awful hack, but seems to be the simplest solution.
-
-
Constructor Summary
Constructors Constructor Description HTTPAuthCache()
HTTPAuthCache(org.apache.http.conn.SchemePortResolver schemePortResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HTTPAuthCache
addProvider(org.apache.http.client.CredentialsProvider cp)
void
remove(org.apache.http.HttpHost host)
HTTPAuthCache
removeProvider(org.apache.http.client.CredentialsProvider cp)
-
-
-
Method Detail
-
remove
public void remove(org.apache.http.HttpHost host)
- Specified by:
remove
in interfaceorg.apache.http.client.AuthCache
- Overrides:
remove
in classorg.apache.http.impl.client.BasicAuthCache
-
addProvider
public HTTPAuthCache addProvider(org.apache.http.client.CredentialsProvider cp)
-
removeProvider
public HTTPAuthCache removeProvider(org.apache.http.client.CredentialsProvider cp)
-
-