Package com.tnsai.server.security
Class WsCapabilityGate
java.lang.Object
com.tnsai.server.security.WsCapabilityGate
WebSocket upgrade-time capability gate (TNS-302).
The client connects to /chat?sessionId=<id>&capability=<token>.
This handler runs as wsBeforeUpgrade(...) (HTTP-level), so it can
short-circuit the upgrade with 403 before the socket exists. After
upgrade, WsHandler relies on the connection-binding contract: the
first frame's sessionId locks the connection, and subsequent frames with a
different sessionId are rejected.
Behaviour:
sessionIdmissing — let through (legacy CLI / explorer; the first frame creates the session and mints a capability via the response on first HTTP touch).sessionIdpresent, session-or-token already exists, capability matches — let through.sessionIdpresent, session exists, capability missing/wrong — reject403.sessionIdpresent, session is new — mint a token and echo viaX-Session-Capabilityresponse header.
-
Constructor Summary
ConstructorsConstructorDescriptionWsCapabilityGate(SessionManager sessionManager, SessionCapabilityStore store) -
Method Summary
-
Constructor Details
-
WsCapabilityGate
-
-
Method Details
-
before
public void before(io.javalin.http.Context ctx)
-