Hi sebb, 
 
Sorry, i should have mentioned it. 
 
I'm using httpclient-4.0-beta1 and yes, 0.0.0.0 is just for show. 
 
thanks,

--- On Sat, 10/4/08, sebb <[EMAIL PROTECTED]> wrote:

From: sebb <[EMAIL PROTECTED]>
Subject: Re: ntlm authentication
To: "HttpClient User Discussion" <[email protected]>
Date: Saturday, October 4, 2008, 9:16 AM

On 04/10/2008, Leo Wraith <[EMAIL PROTECTED]> wrote:
>
>
>  I have a Web application online running on a Linux server. I need to
access files located on a private network running Windows server. The client has
given me a public IP which uses port 8080 that I can use to access the reources
that I need.
>
>  If I type the IP plus the port in IE like so: http://[my ip addres]:8080
I get the prompt to enter the appropriate user and password. When I enter the
user and password that were given to me by the client, I'm able to access
the directories that I need.
>
>  Now, I want to this from my application without user intervention. In
other words, I want to be able to pass the IP, port, userid and password from
within my routine and then access the necessary resources.
>
>  I've been working with several samples but the result is always the
same. When I run the JSP page, I get prompted for the userid and password.
>
>  Could you please take a look at the code snippet and give me a heads-up.
>
>      HttpClient client = new HttpClient();
>      // Set credentials on the client
>      Credentials credentials = new NTCredentials("userid",
"password",
>                                                                          
"http://0.0.0.0:8080";, null);
>      //HttpState state = client.getState();
>      //state().setCredentials(null, null, credentials);
>      client.getState().setCredentials(null, null, credentials);
>      String url = "http://0.0.0.0/PathToFiles";;
>      HttpMethod method = new GetMethod(url);
>      client.executeMethod(method);
>
>      // String responseStr = method.getResponseBodyAsString();
>      // System.out.println(responseStr);
>      // method.releaseConnection();
>
>      String redirectURL = "http://0.0.0.0:8080/PathToFiles"; ;
>      response.sendRedirect(response.encodeRedirectURL(redirectURL));

I assume that 0.0.0.0 is not the real IP address...

>  Thanks so much for the help

Which version of HTTPClient are you using?

BTW, HTTPClient 3.x only ever supported NTLMv1, it does not support NTLMv2.

See also:

http://hc.apache.org/httpclient-3.x/authentication.html#NTLM

http://hc.apache.org/httpcomponents-client/ntlm.html

>
>
>
>
>

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




      

Reply via email to