[jcifs] Windows User Groups

Eric eglass1 at comcast.net
Tue Jun 15 23:16:41 GMT 2004


> Thanks for the quick reply.  I have downloaded and built the rap version,
> however I am a little unsure of how to use the NtlmHttpServletRequest class.
> 
> 
> Should my  doGet method in the servlet accept this request type
> (doGet(NtlmHttpServletRequest req, ...)) ? It is a bit unusual as the class
> is not declared public and therefore can only be accessed from inside the
> package.
>

The functionality is provided via a servlet filter 
(jcifs.httpNtlmHttpFilter); details are at:

http://jcifs.samba.org/src/docs/ntlmhttpauth.html

But basically you don't need to make any modifications to your servlet 
class (other than calling request.getRemoteUser()/request or, in the 
case of groups via RAP, request.isUserInRole()).  You add a filter 
declaration to your deployment descriptor (web.xml):

<filter>
     <filter-name>ntlm</filter-name>
     </filter-class>jcifs.http.NtlmHttpFilter</filter-class>
     ... init parameters go here ...
</filter>
<filter-mapping>
     <filter-name>ntlm</filter-name>
     <url-pattern>/*</url-pattern>
</filter-mapping>

This will cause the container to pass all requests through the filter. 
The filter performs the authentication, and wraps the HttpServletRequest 
in an NtlmHttpServletRequest before passing the request on to your 
servlet.  So for your servlet it's just business as usual.

If you are on an older Servlet 2.2-based platform, you can have your 
servlet class extend NtlmServlet; this provides similar functionality, 
but is a bit more intrusive (as it requires code changes to your 
application).


Eric



More information about the jcifs mailing list