Class SubjectClearingLogoutService<U>
java.lang.Object
com.svenruppert.jsentinel.logout.SubjectClearingLogoutService<U>
- Type Parameters:
U- subject type (only used when scope is CurrentSession, for the SubjectStore wipe)
- All Implemented Interfaces:
LogoutService
Adapter-neutral default
LogoutService implementation.
Clears the current subject from the SubjectStore (when the
scope is LogoutScope.CurrentSession), enumerates active
sessions via the SubjectSessionRegistry, fans the
notification out to every registered LogoutListener, and
emits a LogoutPerformed audit event per logged-out session.
Listener exceptions are swallowed — a misbehaving listener cannot block the logout flow.
-
Constructor Summary
ConstructorsConstructorDescriptionSubjectClearingLogoutService(SubjectStore subjectStore, Class<U> subjectType) Constructs a logout service that only clears the subject store; usesSubjectSessionRegistryno-op behaviour.SubjectClearingLogoutService(SubjectStore subjectStore, Class<U> subjectType, SubjectSessionRegistry registry, JSentinelAuditService auditService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LogoutListener listener) Registers a listener that gets notified once per logged-out session id.voidlogout(SubjectId subjectId, LogoutScope scope) Performs the logout.voidremoveListener(LogoutListener listener) Removes a previously registered listener.
-
Constructor Details
-
SubjectClearingLogoutService
Constructs a logout service that only clears the subject store; usesSubjectSessionRegistryno-op behaviour. Suitable for applications that don't need multi-session logout.- Parameters:
subjectStore- subject store to clear on CurrentSession scopesubjectType- subject type token
-
SubjectClearingLogoutService
public SubjectClearingLogoutService(SubjectStore subjectStore, Class<U> subjectType, SubjectSessionRegistry registry, JSentinelAuditService auditService) - Parameters:
subjectStore- subject store to clear on CurrentSession scopesubjectType- subject type tokenregistry- session registry consulted forLogoutScope.AllSessionsOfSubjectauditService- audit sink, ornullto resolve fromJSentinelServiceResolver.securityAuditService()at logout time
-
-
Method Details
-
logout
Description copied from interface:LogoutServicePerforms the logout.- Specified by:
logoutin interfaceLogoutService- Parameters:
subjectId- subject to log out; non-nullscope- scope of the logout; non-null
-
addListener
Description copied from interface:LogoutServiceRegisters a listener that gets notified once per logged-out session id. Idempotent — registering the same listener twice is a no-op.- Specified by:
addListenerin interfaceLogoutService- Parameters:
listener- non-null
-
removeListener
Description copied from interface:LogoutServiceRemoves a previously registered listener. No-op when the listener was never registered.- Specified by:
removeListenerin interfaceLogoutService- Parameters:
listener- listener to remove
-