[jcifs] RE: Authentication: NTLM

Michael B. Allen miallen at eskimo.com
Fri Aug 16 17:32:12 EST 2002


On Thu, 15 Aug 2002 13:29:35 -0500
"skeetz" <skeetz at 8thdeadlysim.com> wrote:

> Hey All,
> 
> Sorry it took so long for me to reply.  I've been really busy with work and
> a side project of mine.
> 
> >Q: How do you know from within your code where the WEB-INF directory is?
> 
> in jsp session.getServletContext().getRealPath("/") will get the root
> directory of the site.  But I think we are on the right path with the init
> params and the filter.

Actually I guess I don't need this if I parameterize all jcifs.*
properties as init-params. Good to know though.

> 
> >Q: If I have resin setup, am I ready to go to run JSPs? I never have before
> (I don't think anyway).
> 
> Yep it's ready to go right out of the box.  Just use a jsp file extension
> and it will compile and run automatically.

Well,  I  don't  know  spit  about  JSP  but this might need to be explored
because  I  cannot  seem  to figure out how to include a file from within a
servlet  like the jsp:include directive. I've written a nice servlet called
"NetworkExplorer"  that  allows you to basically browse your WAN. I figured
out that if you use a style sheet like this: 

    a {
        display: block;
        float: left;
        width: 300px;
        height: 50px;

All the links are layed out in boxes (no visible border though) so it looks
a lot like Windows Explorer or Network Neigborhood in "Large" view. There's
also  a "Detail" view with a sorting bar. It works very well. If you resize
the  window  the blocks automatically adjust themselves. The source is lean
because  there  are  no  tables. I'd like to make it a standard part of the
package  but  it's not clear to me how I should package the servlet as part
of  the distribution and yet make it available to the container. I'd rather
not  have a separate "war" file in addition to the jar. Can I reference the
servlet        as        jcifs.http.NetworkExplorer       from       within
WEB-INF/lib/jcifs-X.X.X.jar?

Anyway,  I  digress.  What I was trying to ask is how I can pull the inline
style sheet into the output instead of having 100 out.println()s. Do I need
JSP  for  that?  Maybe I can read in a file relative to getRealPath() or is
that "ugly". 

> >how to communicate error messages.
> From the filter you can always output through the ServletResponse object.
> response.getWriter().println("Invalid login attempt");
> 
> I'd like to see what you are doing with the enumeration of parameters.
> Where can I get your code?

I  have quite a few other things that have little to do with NTLM HTTP Auth
so I need a few days before I relase 0.7.0b2 but I've attached the relevant
files if you want to peek.

I really appreciate your help. I'm clueless when it comes to this stuff.

> 
> skeetz
> 
> P.S. Michael, I'm on the list now so you don't have to CC me.

I  wasn't  CCing  you. I was CCing the jCIFS mailing list. You keep sending
stuff  to  me  directly.  It  would be a lot better if you just always went
through  the  list and it wouldn't look like I'm having a conversation with
myself :-> 

> 
> -----Original Message-----
> From: Michael B. Allen [mailto:miallen at eskimo.com]
> Sent: Thursday, August 15, 2002 4:00 AM
> To: skeetz
> Cc: jcifs at samba.org
> Subject: Re: [jcifs] RE: Authentication: NTLM
> 
> 
> On Sun, 11 Aug 2002 13:38:32 -0500
> "skeetz" <skeetz at 8thdeadlysim.com> wrote:
> 
> > NEED TO MOVE PARAMETERS FROM CONFIG FILE TO INIT PARAMS
> 
> Ok,  I  have  looked  at  your code and the servlet docs. I think I get the
> idea.  I  made  a  jcifs.http.NtlmHttpFilter  which  is  a  merger  of your
> LoginFilter and NtlmHttpAuthenticator (little simpler). The NtlmHttpSession
> still  exists  and  will need to be available as an attribute for those who
> wish  to  access  SMB  reasources (e.g. list directories or download files)
> with the provided creds.
> 
> As for init-params, I just enumerate all of them in init() and put the ones
> that start with 'jcifs.' into jcifs.Config. That makes every jCIFS property
> an init-param.
> 
> The one problem with the login Filter is how to communicate error messages.
> How  are  you  supposed  to  indicate  to  the client that the login failed
> because  of  one  of 5 different SmbAuthException.getMessage() reasons? The
> doFilter method is called by the container.
> 
> Will handle the POST issue next.
> 
> 


-- 
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. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NtlmHttpFilter.java
Type: application/octet-stream
Size: 5122 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20020816/badd0956/NtlmHttpFilter.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NtlmHttpSession.java
Type: application/octet-stream
Size: 4381 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20020816/badd0956/NtlmHttpSession.obj


More information about the jcifs mailing list