-
Couldn't load subscription status.
- Fork 38.8k
Description
Rob Winch opened SPR-12845 and commented
Spring Security should be able to default to using the same PathMatcher that Spring WebSockets is using. This is ideal so that they both use the same PathMatcher (i.e. using . or / separators).
Using SimpAnnotationMethodMessageHandler PathMatcher property does not work because it fails with a circular bean reference. This happens because:
- stompWebSocketHandlerMapping requests subProtocolWebSocketHandler
- subProtocolWebSocketHandler requests clientInboundChannel
- clientInboundChannel requests clientInboundChannelExecutor
- clientInboundChannelExecutor requests simpAnnotationMethodMessageHandler. This is due to the fact the creation of clientInboundChannelExecutor invokes configureClientInboundChannel and in order to configureClientInboundChannel, we must lookup simpAnnotationMethodMessageHandler to determine the PatternMatcher
- simpAnnotationMethodMessageHandler then looks up clientInboundChannel (which is a cycle)
You can find my attempt at https://github.com/rwinch/spring-security/tree/SEC-2864 The exact test is AbstractSecurityWebSocketMessageBrokerConfigurerTests#msmsRegistryCustomPatternMatcher
Note that I cannot use MessageBrokerRegistry directly because it is not exposed as a Bean and the accessor is protected.
Issue Links:
- SEC-2864 Default PathMatcher for WebSocket Destination Matching