Interface LogoutService
- All Known Implementing Classes:
NoopLogoutService, SubjectClearingLogoutService
public interface LogoutService
Bundles the logout flow so callers do not have to manually orchestrate
subject removal, session invalidation and navigation.
The logout(SubjectId, LogoutScope) call has two pieces:
CurrentSession— log the subject out of the session associated with the caller.AllSessionsOfSubject— log the subject out of every active session, enumerated via theSubjectSessionRegistry.
Adapters that care about session invalidation register a
LogoutListener via addListener(LogoutListener). The
Vaadin adapter listens to invalidate the VaadinSession and
close the underlying servlet session; the REST adapter listens to
revoke the bearer token.
The core implementation
(SubjectClearingLogoutService) clears the subject from the
SubjectStore,
consults the registry, and fans out the notification to every
registered listener. It does not know about Vaadin sessions, HTTP
sessions, or any specific transport.
-
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.
-
Method Details
-
logout
Performs the logout.- Parameters:
subjectId- subject to log out; non-nullscope- scope of the logout; non-null
-
addListener
Registers a listener that gets notified once per logged-out session id. Idempotent — registering the same listener twice is a no-op.- Parameters:
listener- non-null
-
removeListener
Removes a previously registered listener. No-op when the listener was never registered.- Parameters:
listener- listener to remove
-