Setting the User Timeout in JBoss

Posted Sun, 23 Nov 2003

When most people think of the session timeout in an EJB application, they're typically thinking about the HttpSession timeout of their web front ends. If, however, you need to set the authenticated user timeout in JBoss, it's as easy as adding a parameter to your configuration files...

Edit /server//conf/jboss-service.xml, and look for the following section:

<!-- JAAS security manager and realm mapping -->
<mbean 
  code="org.jboss.security.plugins.JaasSecurityManagerService" 
  name="jboss.security:service=JaasSecurityManager">
     <attribute 
       name="SecurityManagerClassName">
          org.jboss.security.plugins.JaasSecurityManager
     </attribute>
</mbean>

To set the default timeout value, simply add an attribute between inside the tag:

<attribute name="DefaultCacheTimeout">VALUE_IN_SECONDS</attribute>

Each time a client accesses an EJB, the timeout value is checked. If it has been at least as long as the value specified since the last time the client accessed an EJB, then the JAAS manager calls the logout() method of the LoginContext. This will subsequently cause a security exception to be thrown, since the user is no longer authorized to make requests to the EJB.

Related Books

Applied Security Visualization JBoss at Work: A Practical Guide Core J2EE Patterns: Best Practices and Design Strategies (2nd Edition) (Sun Core Series) CCNA Security Official Exam Certification Guide  (Exam 640-553) (Exam Certification Guide) Expert One-on-One J2EE Design and Development (Programmer to Programmer)

Post a Comment




About

My name is Tim Fanelli, I am a software engineer in Northern NY. I spend most of my time working, and when I can, I try to post interesting things here.

Cigar Dossiers