• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Java Implementation of NTLM Proxy authentication ?

Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You may want to look at JCIFS.
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic