Example usage for org.springframework.security.messaging.access.expression MessageExpressionVoter setExpressionHandler

List of usage examples for org.springframework.security.messaging.access.expression MessageExpressionVoter setExpressionHandler

Introduction

In this page you can find the example usage for org.springframework.security.messaging.access.expression MessageExpressionVoter setExpressionHandler.

Prototype

public void setExpressionHandler(SecurityExpressionHandler<Message<T>> expressionHandler) 

Source Link

Usage

From source file:com.northstrat.springsecurity.web.socket.AbstractSecurityWebSocketMessageBrokerConfigurer.java

@Bean
public ChannelSecurityInterceptor inboundChannelSecurity() {
    ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(
            inboundMessageSecurityMetadataSource());
    MessageExpressionVoter<Object> voter = new MessageExpressionVoter<Object>();
    if (expressionHandler != null) {
        voter.setExpressionHandler(expressionHandler);
    }/*from www .  j  a v a 2s.  co  m*/

    List<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>();
    voters.add(voter);

    AffirmativeBased manager = new AffirmativeBased(voters);
    channelSecurityInterceptor.setAccessDecisionManager(manager);
    return channelSecurityInterceptor;
}