Package org.graylog2.security
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Constructor Summary
ConstructorDescriptionUserSessionTerminationService
(MongoDbSessionDAO sessionDao, MongoDBSessionService sessionService, org.apache.shiro.mgt.DefaultSecurityManager securityManager, ClusterConfigService clusterConfigService, UserService userService, com.google.common.eventbus.EventBus eventBus) -
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.shiro.session.Session>
getActiveSessionsForUser
(User user) void
void
Terminate all user sessions, if the revision is outdated.protected void
shutDown()
protected void
startUp()
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString
-
Constructor Details
-
Method Details
-
handleUserChanged
-
startUp
- Specified by:
startUp
in classcom.google.common.util.concurrent.AbstractIdleService
- Throws:
Exception
-
shutDown
- Specified by:
shutDown
in classcom.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
-