On Wed, 2013-06-19 at 10:21 -0400, Jason Millard wrote:
> 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?
> 

HttpClient is apparently wrong

http://msdn.microsoft.com/en-us/library/windows/desktop/aa380525%
28v=vs.85%29.aspx

Please raise a JIRA for this issue.

Oleg



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

Reply via email to