Skip to content

Use Spring's user handling for WS sessions

Spring does support handling of authentication data for WS sessions out-of-the-box, so there is no reason to maintain mappings from WS sessions to user IDs.

Authentication handling has been slightly refactored to set the Principal once when a CONNECT command is received. The Principal is available for all following messages over the same connection. Furthermore, Spring now logs the user ID for the affected WS connection when an error occurs which helps with debugging.

See: https://github.com/spring-projects/spring-framework/blob/5.2.x/src/docs/asciidoc/web/websocket.adoc#token-authentication
Closes: #10 (closed)
Related: #9 (closed)

Edited by Daniel Gerhardt

Merge request reports

Loading