This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Java Implementation of NTLM Proxy authentication ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Java Implementation of NTLM Proxy authentication ?" Watch "Java Implementation of NTLM Proxy authentication ?" New topic
Author

Java Implementation of NTLM Proxy authentication ?

venkat paruchuri
Greenhorn

Joined: Aug 15, 2001
Posts: 28
Hi,

I am trying to implement NTLM proxy authentication in my application. The implementation for Basic and Digest schemes has been pretty straight forward.

For Basic,
-------------
URL url = new URL("http://java.sun.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();

con.setRequestProperty("Proxy-Authenticate", "Basic realm="+ realmName);
String authentication = new sun.misc.BASE64Encoder().encode( (uname + ":"+ pwd).getBytes() );
con.setRequestProperty("Proxy-Authorization", "Basic "+ authentication );

similarly I could implement for Digest mechanism.

I have problem implementing it for NTLM authentication mechanism for Proxy. If a page in the server is protected using NTLM scheme, Internet Explorer will present a dialog to enter username, password and domain(if user belongs to different domain) to get access to the resource on the server.

I have requirment to implement the same in my java application using HTTP Connection. I have no idea how to set the domain, username and pwd in the connection object. I found some information on NTLM at http://davenport.sourceforge.net/ntlm.html which provides with an example in the bottom of the page. But, I did not understand how to set Type 1, Type 2 and Type 3 messages in the connection object.

I appreciate if somebody can help me out ASAP.

Thanks in advance.
dennis zined
Ranch Hand

Joined: Mar 07, 2003
Posts: 330
You may want to look at JCIFS.


SCJP 1.4<br />SCWCD 1.4
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java Implementation of NTLM Proxy authentication ?
 
Similar Threads
Need to implement persistent SSL in java
Http Digest Authentication and HttpsClient Authentication
Setting WEb services credentials
NTLM proxy authentication for HTTP
Converting to HttpClient