Class InMemorySubjectSessionRegistry
java.lang.Object
com.svenruppert.jsentinel.logout.InMemorySubjectSessionRegistry
- All Implemented Interfaces:
SubjectSessionRegistry
In-memory
SubjectSessionRegistry suitable for single-node
deployments and demos.
Thread-safe via a ConcurrentMap keyed by SubjectId.
Each value is a synchronized LinkedHashSet so registrations
preserve insertion order — useful for diagnostics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionForgets every association forsubjectId.voidRecords thatsessionIdbelongs tosubjectId.sessionsOf(SubjectId subjectId) Returns every session id currently associated withsubjectId.voidunregister(SubjectId subjectId, String sessionId) Removes the(subjectId, sessionId)association if present.
-
Constructor Details
-
InMemorySubjectSessionRegistry
public InMemorySubjectSessionRegistry()
-
-
Method Details
-
register
Description copied from interface:SubjectSessionRegistryRecords thatsessionIdbelongs tosubjectId. Idempotent — registering the same pair twice is a no-op.- Specified by:
registerin interfaceSubjectSessionRegistry- Parameters:
subjectId- subject the session belongs tosessionId- opaque session identifier (token, session id, …)
-
unregister
Description copied from interface:SubjectSessionRegistryRemoves the(subjectId, sessionId)association if present. No-op for unknown sessions.- Specified by:
unregisterin interfaceSubjectSessionRegistry- Parameters:
subjectId- subject the session belongs tosessionId- opaque session identifier
-
sessionsOf
Description copied from interface:SubjectSessionRegistryReturns every session id currently associated withsubjectId. The returned collection is a snapshot; subsequentregister/unregistercalls do not leak into it.- Specified by:
sessionsOfin interfaceSubjectSessionRegistry- Parameters:
subjectId- subject to query- Returns:
- snapshot of active session ids, possibly empty
-
clearAll
Description copied from interface:SubjectSessionRegistryForgets every association forsubjectId. Returns the set of removed session ids so the caller can drive downstream cleanup (e.g. revoke tokens, invalidate Vaadin sessions).- Specified by:
clearAllin interfaceSubjectSessionRegistry- Parameters:
subjectId- subject whose sessions to forget- Returns:
- removed session ids
-