package org.jivesoftware.admin;

import org.jivesoftware.util.JiveGlobals;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.annotation.WebListener;

/**
 * A http session listener that implements a configurable session timeout.<p>
 *
 * The session timeout is taken from the property {@code adminConsole.sessionTimeout}, the default is 30min.
 *
 * @author Guido Jaekel, guido.jaekel@gmx.de
 * @author Guus der Kinderen, guus.der.kinderen@gmail.com
 */

@WebListener
public class SessionListener implements HttpSessionListener {

     private static final int sessionTimeout = JiveGlobals.getIntProperty( "adminConsole.sessionTimeout", 30*60 ); // secs


     public void sessionCreated(HttpSessionEvent event){
         event.getSession().setMaxInactiveInterval(sessionTimeout);
     }


     public void sessionDestroyed(HttpSessionEvent event) {
     }

}

Make Admin Console session timeout configurable
OF-2176: Make Admin Console session timeout configurable

Add a http session listener that implements a configurable session timeout.

The session timeout is taken from the property `adminConsole.sessionTimeout`, the default is 30min.