You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "dennis.heimbigner" <de...@gmail.com> on 2015/12/29 21:59:45 UTC

Access internal map of org.apache.http.client.CredentialsProvider

Consider this situation:
I have a proxy that requires a user+pwd
and my ultimate target is a server that also requires
authentication using some arbitrary CredentialsProvider.

My understanding is that In this case, I need to create
a CredentialsProvider that is the union of two other providers:
one for the proxy and one for the ultimate destination server.
Notice that I do not know the contents (i.e. scope X credentials set)
of the latter provider. Also I want to avoid modifying the target 
provider object because that was given to me by the client code.

So, it seems to me that a method needs to be added to CredentialsProvider
to allow me to access its AuthScope -> Credentials map; this could be done
using an iterator or by exporting a map.

An alternate approach would be to actually add the Cloneable
interface to CredentialsProvider. However, the iterator is IMO a more 
general
and usable approach.

Please consider this as a wish/new-feature for  the CredentialsProvider 
interface.
+Dennis Heimbigner
   Unidata/UCAR


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


Re: Access internal map of org.apache.http.client.CredentialsProvider

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2015-12-29 at 13:59 -0700, dennis.heimbigner wrote:
> Consider this situation:
> I have a proxy that requires a user+pwd
> and my ultimate target is a server that also requires
> authentication using some arbitrary CredentialsProvider.
> 
> My understanding is that In this case, I need to create
> a CredentialsProvider that is the union of two other providers:
> one for the proxy and one for the ultimate destination server.
> Notice that I do not know the contents (i.e. scope X credentials set)
> of the latter provider. Also I want to avoid modifying the target 
> provider object because that was given to me by the client code.
> 

One can always decorate CredentialsProvider with a wrapper class and use
the original CredentialsProvider instance as a fallback. It would be a
better solution to the problem in my opinion.

Oleg

> So, it seems to me that a method needs to be added to CredentialsProvider
> to allow me to access its AuthScope -> Credentials map; this could be done
> using an iterator or by exporting a map.
> 
> An alternate approach would be to actually add the Cloneable
> interface to CredentialsProvider. However, the iterator is IMO a more 
> general
> and usable approach.
> 
> Please consider this as a wish/new-feature for  the CredentialsProvider 
> interface.
> +Dennis Heimbigner
>    Unidata/UCAR
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 



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