Using JAAS with Tomcat
Want to use JAAS with Tomcat? If so, you might want to checkout this Using Tomcat with JAAS tutorial.
Although it is possible to use JAAS within Tomcat as an
authentication mechanism (JAASRealm), the flexibility of the JAAS
framework is lost once the user is authenticated. This is because the
principals are used to denote the concepts of "user" and "role", and
are no longer available in the security context in which the webapp is
executed. The result of the authentication is available only through request.getRemoteUser() and request.isUserInRole().
This reduces the JAAS framework for authorization purposes to a
simple user/role system that loses its connection with the Java
Security Policy. This tutorial's purpose is to put a full-blown JAAS
authorisation implementation in place, using a few tricks to deal with
some of Tomcat's idiosyncrasies.
Personally, request.isUserInRole()
usually does everything I need. If I need something more than that, it's usually pretty easy to add some custom logic. Of course, if I ever need anything super robust, I'll probably use the Acegi Security System for Spring.
In a previous life I put an effort into JAAS-ing Expresso. The JAAS complexity increases dramatically when you want to use JAAS for authorisation purposes (<code>Subjec.doAs()</code>), especially data-level authorisation based on associated role (relation to object). Expresso offers this, and we needed it at work, but in the end I gave up. I recently came across an article on the IBM site that explains how to do just that, but it doesn't look nice. One of our architects is currently looking into redesigning our security framework around JAAS, but even on WebSphere 5.1 support for JAAS is, ahum, poor ;)
I'll check out the Acegi system to see if it is interesting.
Posted by Jaap on June 03, 2004 at 06:35 PM MDT #
That was rather prescient Matt - that tutorial is exactly what I need for what I'm working on at the moment! JAAS is cool, but there are annoying factors:
Roberto
Posted by Roberto on June 04, 2004 at 10:23 AM MDT #
Posted by diabolo512 on June 10, 2004 at 06:14 AM MDT #