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

public final class SubjectClearingLogoutService<U> extends Object implements 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 Details

  • Method Details

    • logout

      public void logout(SubjectId subjectId, LogoutScope scope)
      Description copied from interface: LogoutService
      Performs the logout.
      Specified by:
      logout in interface LogoutService
      Parameters:
      subjectId - subject to log out; non-null
      scope - scope of the logout; non-null
    • addListener

      public void addListener(LogoutListener listener)
      Description copied from interface: LogoutService
      Registers a listener that gets notified once per logged-out session id. Idempotent — registering the same listener twice is a no-op.
      Specified by:
      addListener in interface LogoutService
      Parameters:
      listener - non-null
    • removeListener

      public void removeListener(LogoutListener listener)
      Description copied from interface: LogoutService
      Removes a previously registered listener. No-op when the listener was never registered.
      Specified by:
      removeListener in interface LogoutService
      Parameters:
      listener - listener to remove