Package com.tnsai.server.security
Class SessionCapabilityGate
java.lang.Object
com.tnsai.server.security.SessionCapabilityGate
HTTP gate that enforces per-session capability ownership (TNS-302).
Usage from a route handler:
if (!gate.check(ctx, sessionId)) return;
// ... rest of handler — capability has been minted (new) or verified (existing)
Behaviour:
- Session does not yet exist: mint a token, attach it to the response as
X-Session-Capability, returntrue. - Session exists, request presents a matching token: return
true. - Session exists, no token / wrong token: respond
403, returnfalse.
-
Constructor Summary
ConstructorsConstructorDescriptionSessionCapabilityGate(SessionManager sessionManager, SessionCapabilityStore store) -
Method Summary
-
Constructor Details
-
SessionCapabilityGate
-
-
Method Details
-
store
-
check
Verify or mint a capability forsessionId. Writes 403 + skips remaining handlers when verification fails.- Returns:
truewhen the request may proceed.
-