[jcifs] JCIFS NTLM Authentication for HTTP Connections

damien.postlethwaite at ntlworld.com damien.postlethwaite at ntlworld.com
Wed Dec 8 10:24:29 GMT 2004

I tried getting the the System property 'java.protocol.handler.pkgs' before and after calling registerSmbURLHandler() :

pkgs before: com.sun.net.ssl.internal.www.protocol
pkgs after: com.sun.net.ssl.internal.www.protocol|jcifs

As you can see jcifs has been added and there was no Permissions exceptions in the logs.

I captured some packets and can confirm that it is not sending "WWW-Authenticate: NTLM". So guess that BEA weblogic has its own implementation of the http protocol provider that isn't compatable?

Is there anything else that I can try to get this work?

Your help is very much apreciated!


> From: "Michael B Allen" <mba2000 at ioplex.com>
> Date: 2004/12/08 Wed AM 12:02:38 GMT
> To: damien.postlethwaite at ntlworld.com
> CC: jcifs at lists.samba.org
> Subject: Re: [jcifs] JCIFS NTLM Authentication for HTTP Connections
> damien.postlethwaite at ntlworld.com said:
> > Hi,
> >
> > I have successfully managed to use JCIFS to connect to a remote machine
> > and retrieve the content of a webpage via
> > 'jcifs.Config.registerSmbURLHandler();' in the main method of a stand
> > alone java application as described here:
> > 	http://jcifs.samba.org/src/docs/httpclient.html
> >
> > However, the same method does not seem to work when I call it from within
> > a class to provide content to a java portlet that is running from a BEA
> > weblogic web server.
> This undoubted has to do with how the URL handler get's installed or used.
> The below code shows how the SMB URL handler get's installed:
>     public static void registerSmbURLHandler() {
>         String pkgs;
>         pkgs = System.getProperty( "java.protocol.handler.pkgs" );
>         if( pkgs == null ) {
>             System.setProperty( "java.protocol.handler.pkgs", "jcifs" );
>         } else if( pkgs.indexOf( "jcifs" ) == -1 ) {
>             pkgs += "|jcifs";
>             System.setProperty( "java.protocol.handler.pkgs", pkgs );
>         }
>     }
> There are a couple points of failure with this.
> 1) The caller doesn't have permission to set java.protocol.handler.pkgs.
> Try to get the System property 'java.protocol.handler.pkgs' and see if
> 'jcifs' is in the list and look for Permissions exceptions in the logs.
> 2) The container is rudely overriding the java.protocol.handler.pkgs
> property. Try to get the System property 'java.protocol.handler.pkgs' and
> see if 'jcifs' is in the list.
> 3) The handler is actually a wrapper for the default http protocol
> provider. Maybe weblogic is installing it's own implementation that isn't
> compatible with ours (e.g. when we call it it doesn't do what needs to
> happen (e.g. keep-alives) to get NTLM HTTP authentication to work). Get a
> packet trace and see if it's actually sending the WWW-Authenticate: NTLM
> <base64encodeddata> message.
> Mike

Email provided by http://www.ntlhome.com/

More information about the jcifs mailing list