On Thu, 2008-01-10 at 16:06 -0500, Michael Prichard wrote:
> Ok....figured this one out.  Add this:
> 
>               // Sets whether authentication should be attempted preemptively.
>               client.getParams().setAuthenticationPreemptive( true );
> 
>
> And it seems to work perfectly.  No idea why!  Anyone?
> 

This is because BASIC authentication (read: username/password sent in
clear text) is used to authenticate preemptively, not NTLM.   

Apparently the credentials are OK, since you are able to authenticate
using BASIC. So, most likely the server has been configured to use
NTLMv2 only, whereas HttpClient supports NTLMv1 only.

For details see

http://wiki.apache.org/jakarta-httpclient/FrequentlyAskedNTLMQuestions

Oleg 


> Thx.
> 
> 
> On Jan 10, 2008, at 3:22 PM, Michael Prichard wrote:
> 
> > Hello All,
> >
> > I am trying to authenticate to MS Exchange as follows:
> >             
> >             HttpClient client = new HttpClient();
> >             NTCredentials creds = new NTCredentials(_username, _password,  
> > "localhost", _domain);
> >             // set credentials for connection
> >             client.getState().setCredentials(new AuthScope(_exchangeServer, 
> >  
> > AuthScope.ANY_PORT, AuthScope.ANY_REALM), creds);
> >             GetMethod get = new GetMethod(prootPath);
> >             get.setDoAuthentication(true);
> >             status = client.executeMethod(get);
> >
> > When I hit the server I get this back:
> >
> > Jan 10, 2008 3:10:54 PM  
> > org.apache.commons.httpclient.auth.AuthChallengeProcessor  
> > selectAuthScheme
> > INFO: ntlm authentication scheme selected
> > Jan 10, 2008 3:10:54 PM  
> > org.apache.commons.httpclient.HttpMethodDirector  
> > processWWWAuthChallenge
> > INFO: Failure authenticating with NTLM <any  
> > realm>@mail.exchangeserver.com:443
> >
> > I had it working with my internal test server but now when trying  
> > to connect to other servers I am getting Auth issues.  Ideas?
> >
> > Thanks!
> > Michael
> 


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

Reply via email to