Authentication using a ServletFilter

Aug 22, 2010 at 10:14 PM

Hello Dominique,

1. I have copied your  SSPAuthenticator.java Source (without the AD-groups part, I do not need this at the moment) and created a Servlet Filter to authenticate within a web-Application.

If you like, I give you the source so you could consider adding it to your codebase.  Maybe it is of use for others.
The advantage of a Filter is that it is only dependent from the servlet-api (except for the logging, but see below), so it could be used also in another servlet-container..

2. It seems that the only difference between the versions for tomcat 5.5 and tomcat 6 is only the logging.
If you would create and use your own (simple) logging classes, which delegate to the matching tomcat logging classes e.g.
fr.doume.v2.logging.LogFactory;
fr.doume.v2.logging.Log;
you could have only one source code version .. no need to recompile for tc55, no need to build (and provide) 2 different jar files.

Charly

Coordinator
Aug 27, 2010 at 11:17 AM
Edited Aug 27, 2010 at 11:25 AM

Hello Charly,

About the second point: You're right. It is very easy to find the version of tomcat (org.apache.catalina.util.ServerInfo.getServerNumber ()).

About the first point: If you open a new item on Issue Tracker, you can attach a file.

I wanted to use roles. Authorizations are defined in web.xml (Servlets specifications). If you use a filter, you cannot use these definitions. Tomcat uses a Valve to get the information supplied by the user and a Realm to authenticate the user and create a principal with roles. If we do not use a Valve, we must rewrite the Realms. If you do not map roles tomcat on Windows groups, it is a real problem. You must add a solution for each realm  (LDAP, JDBC, xml file, etc. ..).

Thank you for your comments.

Dominique

Jan 5, 2011 at 2:10 PM

Hello,

 

I am interested in that ServletFilter, how can I get it ?

Thanks in advance.

 

Alexandre

Jan 5, 2011 at 11:50 PM

Hello,

I have opened a new item on the issue tracker [workitem:6038] and have attached the source. Alexandre you can download it there.

The filter (currently) does not support groups in AD.  (in my webapps authorization is supported within the webapp without any dependency from AD groups)

Dominique: If you like you can adjust the code and add it to your project.

Charly