[jcifs] problem with java applet needing NTLM proxy authentication

André Warnier aw at ice-sa.com
Wed Mar 11 14:16:06 GMT 2009


This is probably not a jCIFS issue, but I'm addressing this to this 
list, figuring that is where I'll find the required expertise.

(Note : I have already received a hint about this from Chuck Caldarale, 
but honestly I don't know how to handle it.  The hint consisted of the 
code of some of the classes (NTLMAuthentication) of the Sun 
sun.net.www.protocol.http package.  However, I can't quite figure out 
where these would fit).

Summary : we provide a web application to our customers, hosted on our 
Internet website.  Customers access this application from within their 
corporate networks.
In one page of the application, we use a java applet.  This applet 
collects some information from the html form in which it is located, and 
then builds and sends its own POST requests to our server.
It works fine in most cases, but in one customer case it does not, for 
the following reason : at this customer, browsers access the Internet 
through a proxy which requires an NTLM authentication.
The browser's own proxy NTLM authentication works fine, since these 
customers are able to access the pages of our web application, even the 
one containing the applet.
But our java applet knows nothing about NTLM authentication, so when it 
in turn tries to POST to our server, it hits a wall.

I am a bit lost in all this, so I would be grateful for any further 
relevants questions or tips indicating at least a direction in which to 
search for a solution.

To create the POSTs to our server, the applet currently uses the 
following classes :

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.httpclient.methods.multipart.PartBase;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.commons.httpclient.HostConfiguration;

Our applet already picks up from the browser the proxy settings to use 
for the POSTs, and that part works fine.

What I would really like to know, is whether there exists a method by 
which this applet (which in this case runs in a IE browser), can somehow 
obtain from the enclosing browser the NTLM credentials already used by 
the browser for authenticating to the proxy.

The applet can be seen in operation on our website, and I can also 
provide the source code to anyone who is interested.

Thanks in advance

More information about the jcifs mailing list