Class JSentinelVersionCheck
java.lang.Object
com.svenruppert.jsentinel.session.JSentinelVersionCheck
Adapter-neutral security-version drift detector.
Wraps a JSentinelVersionStore and exposes a single
check method
that compares a session's
captured version
against the subject's current version. Any inequality —
including a snapshot that is ahead of the current value
(legitimately produced by
JSentinelVersionStore.reset(JSentinelVersionKey)) — is
reported as JSentinelVersionStatus.Drifted; callers must
treat drift as "session no longer authoritative" regardless of
direction.
Stateless apart from the injected store; safe to share between adapters and threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheck(JSentinelVersionKey key, JSentinelVersion snapshot) Comparessnapshotagainststore.current(key).check(SessionRecord session) Convenience wrapper aroundcheck(JSentinelVersionKey, JSentinelVersion)that pulls the snapshot straight from aSessionRecord.
-
Constructor Details
-
JSentinelVersionCheck
- Parameters:
store- backing version store; non-null
-
-
Method Details
-
check
Comparessnapshotagainststore.current(key).- Parameters:
key- tenant + subject; non-nullsnapshot- version captured when the session was opened; non-null- Returns:
JSentinelVersionStatus.Currentwhen both values match, otherwiseJSentinelVersionStatus.Drifted
-
check
Convenience wrapper aroundcheck(JSentinelVersionKey, JSentinelVersion)that pulls the snapshot straight from aSessionRecord.- Parameters:
session- session to validate; non-null- Returns:
- drift status
-