Skip to content

Misleading documentation for websocket security #4845

@tpianta

Description

@tpianta

Summary

The documentation uses the wrong wildcard in the example for allowing users to subscribe to '/user/' sockets.

Actual Behavior

The docs use a single '*' instead of '**' to wildcard:

https://docs.spring.io/spring-security/site/docs/current/reference/html/websocket.html#websocket-configuration

The java example is incorrect:

@Configuration public class WebSocketSecurityConfig extends AbstractSecurityWebSocketMessageBrokerConfigurer { protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { messages .simpDestMatchers("/user/*").authenticated() } }

Expected Behavior

The correct '**' wildcard is shown in the same docs in the xml example:

<websocket-message-broker> <intercept-message pattern="/user/**" access="hasRole('USER')" /> </websocket-message-broker>

Configuration

Version

Current

Sample

Metadata

Metadata

Assignees

Labels

in: docsAn issue in Documentation or samplestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions