Search in sources :

Example 1 with MessageExpressionVoter

use of org.springframework.security.messaging.access.expression.MessageExpressionVoter in project spring-security by spring-projects.

the class AbstractSecurityWebSocketMessageBrokerConfigurer method inboundChannelSecurity.

@Bean
public ChannelSecurityInterceptor inboundChannelSecurity() {
    ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(inboundMessageSecurityMetadataSource());
    MessageExpressionVoter<Object> voter = new MessageExpressionVoter<Object>();
    voter.setExpressionHandler(getMessageExpressionHandler());
    List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
    voters.add(voter);
    AffirmativeBased manager = new AffirmativeBased(voters);
    channelSecurityInterceptor.setAccessDecisionManager(manager);
    return channelSecurityInterceptor;
}
Also used : MessageExpressionVoter(org.springframework.security.messaging.access.expression.MessageExpressionVoter) AffirmativeBased(org.springframework.security.access.vote.AffirmativeBased) ArrayList(java.util.ArrayList) AccessDecisionVoter(org.springframework.security.access.AccessDecisionVoter) ChannelSecurityInterceptor(org.springframework.security.messaging.access.intercept.ChannelSecurityInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 2 with MessageExpressionVoter

use of org.springframework.security.messaging.access.expression.MessageExpressionVoter in project spring-security by spring-projects.

the class AbstractSecurityWebSocketMessageBrokerConfigurer method inboundChannelSecurity.

@Bean
public ChannelSecurityInterceptor inboundChannelSecurity(MessageSecurityMetadataSource messageSecurityMetadataSource) {
    ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(messageSecurityMetadataSource);
    MessageExpressionVoter<Object> voter = new MessageExpressionVoter<>();
    voter.setExpressionHandler(getMessageExpressionHandler());
    List<AccessDecisionVoter<?>> voters = new ArrayList<>();
    voters.add(voter);
    AffirmativeBased manager = new AffirmativeBased(voters);
    channelSecurityInterceptor.setAccessDecisionManager(manager);
    return channelSecurityInterceptor;
}
Also used : MessageExpressionVoter(org.springframework.security.messaging.access.expression.MessageExpressionVoter) AffirmativeBased(org.springframework.security.access.vote.AffirmativeBased) ArrayList(java.util.ArrayList) AccessDecisionVoter(org.springframework.security.access.AccessDecisionVoter) ChannelSecurityInterceptor(org.springframework.security.messaging.access.intercept.ChannelSecurityInterceptor) Bean(org.springframework.context.annotation.Bean)

Aggregations

ArrayList (java.util.ArrayList)2 Bean (org.springframework.context.annotation.Bean)2 AccessDecisionVoter (org.springframework.security.access.AccessDecisionVoter)2 AffirmativeBased (org.springframework.security.access.vote.AffirmativeBased)2 MessageExpressionVoter (org.springframework.security.messaging.access.expression.MessageExpressionVoter)2 ChannelSecurityInterceptor (org.springframework.security.messaging.access.intercept.ChannelSecurityInterceptor)2