Class UserSessionTerminationService

java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.security.UserSessionTerminationService
All Implemented Interfaces:
com.google.common.util.concurrent.Service

@Singleton public class UserSessionTerminationService extends com.google.common.util.concurrent.AbstractIdleService
This service checks on startup if all user sessions should be terminated. This can be requested by bumping the TERMINATION_REVISION number. The service also listens for UserChangedEvent events and terminates all sessions for disabled users.
  • Constructor Details

  • Method Details

    • handleUserChanged

      public void handleUserChanged(UserChangedEvent event)
    • startUp

      protected void startUp() throws Exception
      Specified by:
      startUp in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • shutDown

      protected void shutDown() throws Exception
      Specified by:
      shutDown in class com.google.common.util.concurrent.AbstractIdleService
      Throws:
      Exception
    • runGlobalSessionTermination

      public void runGlobalSessionTermination()
      Terminate all user sessions, if the revision is outdated.

      To make sure that we don't terminate user sessions concurrently, this method should be called on the primary node only.

    • getActiveSessionsForUser

      public List<org.apache.shiro.session.Session> getActiveSessionsForUser(User user)