[jcifs] NTLM Standalone Authentication

Michael B. Allen miallen at eskimo.com
Tue Oct 1 05:40:58 EST 2002

On Mon, 30 Sep 2002 13:36:52 -0400
Joseph Kezar <jkezar at romz.no-ip.com> wrote:

> Thanks Eric!
>     That worked great for our needs.  I am curious why the API tells 
> developers to avoid using the class SmbSession.
> And why does the API documentation say this: "This class will be hidden 
> from the distribution API documentation at some time in the future. "?

Actually  I  think  I was a little over zealous when I added that text. The
SmbSession.logon()  method will be the definitive method. Unfortunately 0.7
is  going  through  major  changes.  Very pervasive changes that will break
backwards compatibilty (see message about URL semantics).

For   production   you  should  definately  be  using  0.6.6  with  special
consideration for the 3 bugs mentioned in the latest news bullet on our web
page.  For  authentication  only,  you  can use Nick's fine NTAuthenticator
class  (you'll  have  to  rebuild  the package) but I don't know if I would
tryClose()  with  higher volume because you're just bringing up and tearing
down  transport  all  the  time  (unless your exits after in which case you
would).  Or you could just do an exists() on a dummy share and return false
in the catch( SmbAuthException ). 

> Is jCIFS mainly for tomcat/resin support?  I write alot of standalone 

Ha  ha.  No.  Support  for http related services is summarized in the "NTLM
HTTP  Authentication  and  the  New  jcifs.http Package" news bullet on our

> applications that require some sort of password authtication(against a 
> PDC) and this seems to do the trick.  
> Glass, Eric wrote:
> >Look at SmbSession.logon, something like this:
> >
> >NtlmPasswordAuthentication auth =
> >        new NtlmPasswordAuthentication("domain", "username", "password");
> >UniAddress dc = UniAddress.getByName("pdcname");
> >try {
> >    SmbSession.logon(dc, auth);
> >    return true;
> >} catch (SmbException ex) {

I  think  you  might  want  this to be SmbAuthException. That way you throw
network and name service exceptions. 

A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and more importantly to tasks that have not
yet been conceived. 

More information about the jcifs mailing list