Example usage for org.springframework.security.access.vote AffirmativeBased AffirmativeBased

List of usage examples for org.springframework.security.access.vote AffirmativeBased AffirmativeBased

Introduction

In this page you can find the example usage for org.springframework.security.access.vote AffirmativeBased AffirmativeBased.

Prototype

public AffirmativeBased(List<AccessDecisionVoter<? extends Object>> decisionVoters) 

Source Link

Usage

From source file:com.swordcode.webcore.security.server.MethodSecurityConfig.java

@SuppressWarnings("rawtypes")
@Override/*from w  w  w. j  a  va  2  s. c  o m*/
protected AccessDecisionManager accessDecisionManager() {
    List<AccessDecisionVoter> decisionVoters = new ArrayList<>();
    ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
    expressionAdvice.setExpressionHandler(getExpressionHandler());

    // If prePostEnabled
    decisionVoters.add(new PreInvocationAuthorizationAdviceVoter(expressionAdvice));

    RoleVoter rv = new RoleVoter();
    rv.setRolePrefix("");
    decisionVoters.add(rv);
    decisionVoters.add(new AuthenticatedVoter());
    return new AffirmativeBased(decisionVoters);
}

From source file:ch.rasc.wampspring.security.AbstractSecurityWampConfigurer.java

@Bean
public ChannelSecurityInterceptor inboundChannelSecurity() {
    ChannelSecurityInterceptor channelSecurityInterceptor = new ChannelSecurityInterceptor(
            inboundMessageSecurityMetadataSource());
    List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<>();
    voters.add(new MessageExpressionVoter<>());
    AffirmativeBased manager = new AffirmativeBased(voters);
    channelSecurityInterceptor.setAccessDecisionManager(manager);
    return channelSecurityInterceptor;
}

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);
    }/*ww w .j a  v a2  s .co m*/

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

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

From source file:com.muk.spring.config.SpringSecurityConfig.java

@Bean(name = "camelAccessDecisionManager")
public AccessDecisionManager accessDecisionManager() {
    final List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
    voters.add(new RoleVoter());

    final AffirmativeBased decisionManager = new AffirmativeBased(voters);
    decisionManager.setAllowIfAllAbstainDecisions(true);

    return decisionManager;
}

From source file:org.jblogcms.core.config.SecurityContext.java

@Bean
public AffirmativeBased getAccessDecisionManager(RoleHierarchy roleHierarchy) {
    DefaultWebSecurityExpressionHandler expressionHandler = new DefaultWebSecurityExpressionHandler();
    expressionHandler.setRoleHierarchy(roleHierarchy);

    WebExpressionVoter webExpressionVoter = new WebExpressionVoter();
    webExpressionVoter.setExpressionHandler(expressionHandler);

    List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();

    voters.add(webExpressionVoter);/*from w ww.  ja  va2s  .co m*/
    return new AffirmativeBased(voters);
}

From source file:org.davidmendoza.esu.config.SecurityConfig.java

@Bean
@SuppressWarnings("unchecked")
public AccessDecisionManager defaultAccessDecisionManager() {
    DefaultWebSecurityExpressionHandler defaultWebSecurityExpressionHandler = new DefaultWebSecurityExpressionHandler();
    defaultWebSecurityExpressionHandler.setRoleHierarchy(roleHierarchy());
    WebExpressionVoter webExpressionVoter = new WebExpressionVoter();
    webExpressionVoter.setExpressionHandler(defaultWebSecurityExpressionHandler);
    List voters = new ArrayList<>();
    voters.add(webExpressionVoter);/*from   www .j  ava 2  s.c o  m*/
    AccessDecisionManager result = new AffirmativeBased(voters);
    return result;
}

From source file:org.lightadmin.core.config.context.LightAdminSecurityConfiguration.java

@Bean
@Autowired/*ww w  .j a v  a2s  . c o  m*/
public Filter filterSecurityInterceptor(AuthenticationManager authenticationManager) throws Exception {
    FilterSecurityInterceptor filter = new FilterSecurityInterceptor();
    filter.setAuthenticationManager(authenticationManager);
    filter.setAccessDecisionManager(new AffirmativeBased(Arrays
            .<AccessDecisionVoter<? extends Object>>asList((AccessDecisionVoter<Object>) new RoleVoter())));
    filter.setSecurityMetadataSource(securityMetadataSource());
    filter.afterPropertiesSet();
    return filter;
}

From source file:eu.freme.common.security.SecurityConfig.java

@Bean
public AffirmativeBased defaultAccessDecisionManager() {

    @SuppressWarnings("rawtypes")
    AffirmativeBased ab = new AffirmativeBased(accessDecisionVoters);
    return ab;//from   ww w.j  a  v a 2  s.  co  m
}

From source file:org.wallride.autoconfigure.WallRideSecurityConfiguration.java

@Bean
public AffirmativeBased accessDecisionManager() {
    List<AccessDecisionVoter<?>> accessDecisionVoters = new ArrayList<>();
    accessDecisionVoters.add(roleVoter());
    accessDecisionVoters.add(webExpressionVoter());

    AffirmativeBased accessDecisionManager = new AffirmativeBased(accessDecisionVoters);
    return accessDecisionManager;
}

From source file:nu.localhost.tapestry5.springsecurity.services.SecurityModule.java

@Marker(SpringSecurityServices.class)
public final AccessDecisionManager buildAccessDecisionManager(final List<AccessDecisionVoter> voters)
        throws Exception {
    final AffirmativeBased manager = new AffirmativeBased(voters);
    manager.afterPropertiesSet();//  www .  j  a va 2 s.  c o m
    return manager;
}