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 rangeli nepal <ra...@gmail.com> on 2010/04/11 01:28:16 UTC
Fwd: Authorization Header
Hello Everybody,
Recently I inherited a application built on top of httpclient ( written with
httpclient 3) that communicate with server using ssl client auth.
Now we want to add a feature to add a Authorization header having custom
scheme and value. ie.
Authorization: Custom customValue= <Some string>
I am not sure what exactly we need to do from httpclient perspective. Any
help will be highly appreciated.
I did try to creatte customCredential and AuthScheme. But unfortunately it
does not create any authorization header. I have
set preemptive Authentication
httpClient.getParams().setAuthenticationPreemptive(true);
AuthPolicy.registerAuthScheme(FooAuthScheme.NAME,
DeceAuthScheme.class);
List authPrefs = new ArrayList(1);
authPrefs.add(AuthPolicy.getAuthScheme(FooAuthScheme.NAME));
params.setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
InflateEncode iEncode=new InflateEncode(true);
String encodedString=iEncode.getEncodeString();
httpClient.getState().setCredentials(new AuthScope("myhost", 8080,
AuthScope.ANY_REALM), new
FooCredentials(encodedString)) ;
Thank you.
rn