Hello.

I'm using HTTPClient 4.2.5 to fetch a variety of resources in a very simple way.

String url="http://...";;
DefaultHttpClient httpClient = new DefaultHttpClient();
httpClient.getCredentialsProvider().setCredentials(
   new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
   new NTCredentials("USERNAME", "PASSWORD", "", "DOMAIN"));
HttpResponse proxiedResponse = httpClient.execute(new HttpGet(url));
int statusCode = proxiedResponse.getStatusLine().getStatusCode();

99% of the time, were using NTLM auth, so everything works fine.

However, I just hit an instance where Basic Authentication was failing
with a 401.


I then tried using UsernamePasswordCredentials and started getting 200's:

httpClient.getCredentialsProvider().setCredentials(
   new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT),
   new UsernamePasswordCredentials("DOMAIN\\USERNAME", "PASSWORD"));


After turning on debug I compared the Authorization headers and saw
they were different:

2013/06/19 10:05:11:476 EDT [DEBUG] headers - >> Authorization: Basic ...

When using NTCredentials, it is sending "DOMAIN/USERNAME" instead of
"DOMAIN\USERNAME".

Is "DOMAIN/USERNAME" correct according to specifications, or is the
server I'm trying to call incorrect and not handling the credentials
properly?

Thanks,
-- Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to