hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Custom AuthScheme
Date Fri, 12 Mar 2010 18:34:33 GMT
Jean-Philippe Steinmetz wrote:
> Hello everyone,
> I'm currently working with httpclient 4.1.alpha1 and am trying to create a
> custom authorization scheme. I've got the scheme all coded up but i'm having
> trouble actually getting it to execute with the client.
> Here's how I am registering the scheme/creds to the client.
> httpclient.getAuthSchemes().register("CUSTOM", new CustomSchemeFactory());
> List<String> authpref = new ArrayList<String>();
> authpref.add("CUSTOM");
> httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
> httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, new
> UsernamePasswordCredentials(username, password));
> I have System.out messages all throughout my code including in the
> SchemeFactory.newInstance function and i'm not getting any output when I
> run. I can also confirm this even with a debugger. So what exactly am I
> doing wrong here?

I see nothing wrong with your code. However, if the server does not 
challenge the client with a auth request that includes CUSTOM scheme, 
the client-side auth scheme will never get executed.

> Also, is it possible to spit out the request, in it's entirety, right before
> it's actually sent to the server? It would be greatly helpful in debugging
> communication with the server.

Certainly. See http://hc.apache.org/httpcomponents-client/logging.html


> Cheers,
> Jean-Philippe Steinmetz

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

View raw message