Class JSentinelVersionEnforcer
java.lang.Object
com.svenruppert.jsentinel.session.JSentinelVersionEnforcer
Adapter-neutral enforcement layer on top of
JSentinelVersionCheck. Adapters call
enforce(...) per request with the subject + session snapshot and
pattern-match on the returned JSentinelVersionEnforcer.EnforcementOutcome:
JSentinelVersionEnforcer.EnforcementOutcome.Continue— request proceeds; the VaadinAuthorizationListeneror RESTRestAuthorizationFilterruns next as usual.JSentinelVersionEnforcer.EnforcementOutcome.SessionStale— request must be refused. Vaadin reroutes to the login route; REST returns 401 withWWW-Authenticate: SessionStale. The enforcer has already published the audit event when this is returned.
Audit failures are swallowed — a misbehaving sink cannot turn a drift into a "Continue".
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSealed outcome of anenforce(SubjectId, TenantId, JSentinelVersion, String, String)call. -
Constructor Summary
ConstructorsConstructorDescriptionJSentinelVersionEnforcer(JSentinelVersionCheck check, JSentinelAuditService auditService, Clock clock) Full constructor.JSentinelVersionEnforcer(JSentinelVersionStore store, JSentinelAuditService auditService) -
Method Summary
Modifier and TypeMethodDescriptionenforce(SubjectId subjectId, TenantId tenant, JSentinelVersion snapshot, String sessionId, String route) Runs the drift check and emits aSessionStaleaudit event on drift.
-
Constructor Details
-
JSentinelVersionEnforcer
- Parameters:
store- version store used to derive the current value; non-nullauditService- audit sink forSessionStaleevents; non-null
-
JSentinelVersionEnforcer
public JSentinelVersionEnforcer(JSentinelVersionCheck check, JSentinelAuditService auditService, Clock clock) Full constructor.- Parameters:
check- version check; non-nullauditService- audit sink forSessionStaleevents; non-nullclock- time source for the audit timestamp; non-null
-
-
Method Details
-
enforce
public JSentinelVersionEnforcer.EnforcementOutcome enforce(SubjectId subjectId, TenantId tenant, JSentinelVersion snapshot, String sessionId, String route) Runs the drift check and emits aSessionStaleaudit event on drift.- Parameters:
subjectId- authenticated subject; non-nulltenant- tenant scope;nullbecomesTenantId.DEFAULTsnapshot- session'scaptured version; non-nullsessionId- session identifier for the audit event; may benullroute- navigation route / REST path for the audit event; may benull- Returns:
- enforcement outcome
-