fix: NCS-122 authenticate WebSocket connections via first-message auth #73

Merged
Janis merged 2 commits from fix/NCS-122-ws-token-auth into main 2026-06-17 10:42:54 +02:00

2 Commits

Author SHA1 Message Date
LQ63 e8ff9cd6e6 style(ncs-122): fix scalafmt alignment in GameWebSocketResource
Build & Test (NowChessSystems) TeamCity build finished
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 10:01:07 +02:00
LQ63 a75a3cc421 fix(ncs-122): authenticate WebSocket connections via first-message auth
Build & Test (NowChessSystems) TeamCity build failed
Replace header-based auth (not possible with browser WebSocket API) with a
first-message auth protocol: client sends {"type":"auth","token":"<JWT>"}
as the first text frame; server validates and proceeds or closes the connection.

Both GameWebSocketResource and UserWebSocketResource now hold incoming
connections in a pendingAuth set until the auth frame arrives, preventing
any game or event messages from being processed before identity is established.

Also removes the broken Bearer-prefix handling that caused header-based auth
to silently fail even for non-browser clients.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 09:45:47 +02:00