lablink_allocator_service.routes.internal_proxy_auth¶
lablink_allocator_service.routes.internal_proxy_auth
¶
POST /internal/proxy_auth — nginx auth_request callback.
Validates the lablink_session cookie and the browser_token from the original URI; on success, returns X-Upstream and X-Auth-Basic response headers so nginx can dial the upstream KasmVNC and attach the HTTP Basic Authorization header to the upstream WebSocket handshake. KasmVNC's auth is username-based; we use a fixed username and rotate only the password. The browser never sees either.
Attributes¶
KASMVNC_USERNAME = 'kasm_user'
module-attribute
¶
bp = Blueprint('internal_proxy_auth', __name__)
module-attribute
¶
Classes¶
Functions:¶
proxy_auth()
¶
nginx auth_request gate for the desktop WebSocket proxy.
Auth: None — an auth_request subrequest target for the allocator's own nginx, never routed publicly.
nginx calls this before proxying desktop bytes, to check that the
requesting session is entitled to the client it is asking for: the
signed lablink_session cookie must resolve to the VM whose
browser_token appears in the original URI.
Source code in packages/allocator/src/lablink_allocator_service/routes/internal_proxy_auth.py
tunnel_auth()
¶
nginx auth_request gate for the reverse-tunnel WebSocket upgrade.
The path prefix identifies which client is attaching; the bearer token is what authenticates it. Both must agree, so a client cannot attach under another client's prefix even holding a valid secret of its own.
This check is the ONLY binding between a secret and an identity. tunnel_manager's restrictions are keyed by path prefix, so they grant whatever alias the presented path claims -- they constrain a client to one alias, they do not prove who the client is. Do not describe them as a second authentication layer.