All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sk.seges.acris.security.server.spring.configuration.AccessDecisionManagerConfiguration Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package sk.seges.acris.security.server.spring.configuration;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.security.vote.AccessDecisionVoter;
import org.springframework.security.vote.AffirmativeBased;
import org.springframework.security.vote.RoleVoter;
import org.springframework.security.vote.UnanimousBased;

public class AccessDecisionManagerConfiguration {

	@Bean
    public RoleVoter roleVoter() {
    	return new RoleVoter();
    }

	@Bean
	public UnanimousBased unanonimousDecisionManager() {
		UnanimousBased decisionManager = new UnanimousBased();
		decisionManager.setAllowIfAllAbstainDecisions(true);

		List decissionVoters = new ArrayList();
		decissionVoters.add(roleVoter());
		decisionManager.setDecisionVoters(decissionVoters);

		return decisionManager;
	}

	@Bean
	public AffirmativeBased AffirmativeAccessDecisionManager() {
		AffirmativeBased decisionManager = new AffirmativeBased();
		decisionManager.setAllowIfAllAbstainDecisions(false);
		
		List decissionVoters = new ArrayList();
		decissionVoters.add(roleVoter());
		decisionManager.setDecisionVoters(decissionVoters);
		
		return decisionManager;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy