File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Java Implementation of NTLM Proxy authentication ?" Watch "Java Implementation of NTLM Proxy authentication ?" New topic

Java Implementation of NTLM Proxy authentication ?

venkat paruchuri

Joined: Aug 15, 2001
Posts: 28

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("");
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 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
I agree. Here's the link:
subject: Java Implementation of NTLM Proxy authentication ?
It's not a secret anymore!