@@ -1724,19 +1724,11 @@ HTTP session (which is then associated with WebSocket or SockJS sessions created
1724
1724
for that user) and results in a user header being stamped on every `Message` flowing
1725
1725
through the application.
1726
1726
1727
- Note that the STOMP protocol does have `login` and `passcode` headers
1728
- on the `CONNECT` frame. Those were originally designed for and are still needed,
1729
- for example, for STOMP over TCP. However, for STOMP over WebSocket, by default,
1730
- Spring ignores authorization headers at the STOMP protocol level, assumes that
1731
- the user is already authenticated at the HTTP transport level, and expects that
1732
- the WebSocket or SockJS session contain the authenticated user.
1733
-
1734
- NOTE: Spring Security provides
1735
- https://docs.spring.io/spring-security/reference/servlet/integrations/websocket.html#websocket-authorization[WebSocket sub-protocol authorization]
1736
- that uses a `ChannelInterceptor` to authorize messages based on the user header in them.
1737
- Also, Spring Session provides
1738
- https://docs.spring.io/spring-session/reference/web-socket.html[WebSocket integration]
1739
- that ensures the user's HTTP session does not expire while the WebSocket session is still active.
1727
+ The STOMP protocol does have `login` and `passcode` headers on the `CONNECT` frame.
1728
+ Those were originally designed for and are needed for STOMP over TCP. However, for STOMP
1729
+ over WebSocket, by default, Spring ignores authentication headers at the STOMP protocol
1730
+ level, and assumes that the user is already authenticated at the HTTP transport level.
1731
+ The expectation is that the WebSocket or SockJS session contain the authenticated user.
1740
1732
1741
1733
1742
1734
@@ -1814,6 +1806,18 @@ its own implementation of `WebSocketMessageBrokerConfigurer` that is marked with
1814
1806
1815
1807
1816
1808
1809
+ [[websocket-stomp-authorization]]
1810
+ === Authorization
1811
+
1812
+ Spring Security provides
1813
+ https://docs.spring.io/spring-security/reference/servlet/integrations/websocket.html#websocket-authorization[WebSocket sub-protocol authorization]
1814
+ that uses a `ChannelInterceptor` to authorize messages based on the user header in them.
1815
+ Also, Spring Session provides
1816
+ https://docs.spring.io/spring-session/reference/web-socket.html[WebSocket integration]
1817
+ that ensures the user's HTTP session does not expire while the WebSocket session is still active.
1818
+
1819
+
1820
+
1817
1821
[[websocket-stomp-user-destination]]
1818
1822
=== User Destinations
1819
1823
0 commit comments