Annotation Interface EnableWebSocketSecurity
@Retention(RUNTIME)
@Target(TYPE)
@Documented
@Import({org.springframework.security.config.annotation.web.socket.WebSocketMessageBrokerSecurityConfiguration.class,org.springframework.security.config.annotation.web.socket.WebSocketObservationImportSelector.class})
public @interface EnableWebSocketSecurity
Allows configuring WebSocket Authorization.
For example:
@Configuration @EnableWebSocketSecurity public class WebSocketSecurityConfig { @Bean AuthorizationManager<Message<?>> authorizationManager(MessageMatcherDelegatingAuthorizationManager.Builder messages) { messages.simpDestMatchers("/user/queue/errors").permitAll() .simpDestMatchers("/admin/**").hasRole("ADMIN") .anyMessage().authenticated(); return messages.build(); } }
- Since:
- 5.8