Hi,

I am using HttpClient 3.0 and have a problem with preemptive authentication and redirects.

The scenario is as follows:

1. I create a GetMethod with a certain URI, lets say www.foo.com which redirects to bar.foo.com
  that requires authentication.

2. I lookup a registry with stored credentials for this URI and find Username + Password

3. I call HttpClient.getParams().setAuthenticationPreemptive(true);

4. I create AuthScope and Credentials, asking the GetMethod for Host, Port and Realm. For Host
  I am getting "www.foo.com".

5. I call HttpClient.getState().setCredentials(authScope, userPwCreds);

6. I call getMethod.setDoAuthentication(true);

Now, I execute the GetMethod and it gets redirected to "bar.foo.com". Thereby the AuthScope I created preemptively with "www.foo.com" is no longer valid. I get an 401 error, although
the credentials are correct, just the host is not.

Is there a workaround for avoiding this problem? I tried to supply ANY_HOST as value for the AuthScope but get the exception that NULL is not allowed (though the API tells me
that I can supply ANY_HOST if I want to).

Thanks for helping,
Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to