Class WebSocketMessageBrokerSecurityBeanDefinitionParser

java.lang.Object
org.springframework.security.config.websocket.WebSocketMessageBrokerSecurityBeanDefinitionParser
All Implemented Interfaces:
org.springframework.beans.factory.xml.BeanDefinitionParser

public final class WebSocketMessageBrokerSecurityBeanDefinitionParser extends Object implements org.springframework.beans.factory.xml.BeanDefinitionParser
Parses Spring Security's websocket namespace support. A simple example is: <websocket-message-broker> <intercept-message pattern='/permitAll' access='permitAll' /> <intercept-message pattern='/denyAll' access='denyAll' /> </websocket-message-broker>

The above configuration will ensure that any SimpAnnotationMethodMessageHandler has the AuthenticationPrincipalArgumentResolver registered as a custom argument resolver. It also ensures that the SecurityContextChannelInterceptor is automatically registered for the clientInboundChannel. Last, it ensures that a ChannelSecurityInterceptor is registered with the clientInboundChannel.

If finer control is necessary, the id attribute can be used as shown below:

<websocket-message-broker id="channelSecurityInterceptor"> <intercept-message pattern='/permitAll' access='permitAll' /> <intercept-message pattern='/denyAll' access='denyAll' /> </websocket-message-broker>

Now the configuration will only create a bean named ChannelSecurityInterceptor and assign it to the id of channelSecurityInterceptor. Users can explicitly wire Spring Security using the standard Spring Messaging XML namespace support.

Since:
4.0
  • Constructor Details

    • WebSocketMessageBrokerSecurityBeanDefinitionParser

      public WebSocketMessageBrokerSecurityBeanDefinitionParser()
  • Method Details

    • parse

      public org.springframework.beans.factory.config.BeanDefinition parse(Element element, org.springframework.beans.factory.xml.ParserContext parserContext)
      Specified by:
      parse in interface org.springframework.beans.factory.xml.BeanDefinitionParser
      Parameters:
      element -
      parserContext -
      Returns:
      the BeanDefinition