On Fri, 2013-02-01 at 03:23 -0800, Mihai David wrote:
> Hi,
> 
> I have tried several http connections using httpclient to a Windows Server 
> 2008 R2 standard host running  IIS 7.5. I have trouble authenticating local 
> users if the host is included in a domain. Domain users or local users if the 
> host is in a workgroup work fine.
> 
> So I am using ntlm or digest authentication and:
>  - Authentication with a domain user works fine
>  - Authentication with a local user if the host is in a workgroup works fine
>  - Authentication with a local user (e.g. Administrator) if the host is in a 
> domain returns 401 - Unauthorized
> 
> 

What version of HttpClient are you using?

Oleg

> My code:
> 
> 
> //using local user returns "401 - Unauthorized" if the host is part of a 
> domain
> NTCredentials creds = new NTCredentials("Administrator", "password", 
> "myworkstation", "HOSTNAME");
> //domain user works fine:
> //NTCredentials creds = new NTCredentials("USERNAME", "password", 
> "myworkstation", "DOMAIN");
> 
> DefaultHttpClient httpclient = new DefaultHttpClient();
> httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY, creds);
> HttpHost target = new HttpHost("xx.xx.xx.xx", 81, "http");
> HttpContext localContext = new BasicHttpContext();
> HttpGet httpget = new HttpGet("/Orchestrator2012/Orchestrator.svc/Jobs");
> List<String> authpref = new ArrayList<String>();
> authpref.add(AuthPolicy.NTLM);
> httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref);
> HttpResponse response1 = httpclient.execute(target, httpget, localContext);
> HttpEntity entity1 = response1.getEntity();
> 
> Any feedback would be highly appreciated. Thanks
> Mihai



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

Reply via email to