Class VaadinJSentinelVersionContext
java.lang.Object
com.svenruppert.jsentinel.session.vaadin.VaadinJSentinelVersionContext
Per-
VaadinSession carrier for the security-version
snapshot captured at login time. The
Vaadin enforcer
listener consults this context on every navigation; the
application records it once after a successful login via
record.
Stored as a single VaadinJSentinelVersionContext.Snapshot object under the
VaadinJSentinelVersionContext.Snapshot class key, so it survives session-id rotation
(the attribute lives on the VaadinSession, not on the
WrappedSession).
This class only reads and writes — it does not consult the
JSentinelVersionStore itself. Apps that want
"capture-current-on-login" semantics pair this helper with a
call to
versionStore.current(new JSentinelVersionKey(tenant, subjectId))
right before record.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordPer-session security state captured at login time. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Removes the snapshot fromVaadinSession.getCurrent().static voidclear(com.vaadin.flow.server.VaadinSession session) Removes the snapshot fromsession.current()Reads the recorded snapshot fromVaadinSession.getCurrent().current(com.vaadin.flow.server.VaadinSession session) Returns the recorded snapshot forsession, or empty when none was recorded.static voidrecord(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.authorization.api.tenant.TenantId tenant, com.svenruppert.jsentinel.session.JSentinelVersion snapshot, String sessionId) Convenience overload writing toVaadinSession.getCurrent().static voidrecord(com.vaadin.flow.server.VaadinSession session, com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.authorization.api.tenant.TenantId tenant, com.svenruppert.jsentinel.session.JSentinelVersion snapshot, String sessionId) Records the snapshot on the supplied session.
-
Method Details
-
record
public static void record(com.vaadin.flow.server.VaadinSession session, com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.authorization.api.tenant.TenantId tenant, com.svenruppert.jsentinel.session.JSentinelVersion snapshot, String sessionId) Records the snapshot on the supplied session. Replaces any previously recorded snapshot.- Parameters:
session- target session; non-nullsubjectId- authenticated subject; non-nulltenant- tenant scope;nullbecomesTenantId.DEFAULTsnapshot- security version captured at login time; non-nullsessionId- opaque session identifier (typically the servlet-session id); may benullwhen the adapter does not track session ids
-
record
public static void record(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.authorization.api.tenant.TenantId tenant, com.svenruppert.jsentinel.session.JSentinelVersion snapshot, String sessionId) Convenience overload writing toVaadinSession.getCurrent(). No-op when no session is bound.- Parameters:
subjectId- authenticated subject; non-nulltenant- tenant scope;nullbecomesTenantId.DEFAULTsnapshot- security version captured at login time; non-nullsessionId- opaque session identifier; may benull
-
current
public static Optional<VaadinJSentinelVersionContext.Snapshot> current(com.vaadin.flow.server.VaadinSession session) Returns the recorded snapshot forsession, or empty when none was recorded.- Parameters:
session- session to query;nullreturns empty- Returns:
- recorded snapshot, if present
-
current
Reads the recorded snapshot fromVaadinSession.getCurrent().- Returns:
- recorded snapshot, if present
-
clear
public static void clear(com.vaadin.flow.server.VaadinSession session) Removes the snapshot fromsession. No-op when no snapshot was recorded.- Parameters:
session- session to clear;nullis a no-op
-
clear
public static void clear()Removes the snapshot fromVaadinSession.getCurrent().
-