org.springframework.security.access.vote.UnanimousBased.setDecisionVoters()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.springframework.security.access.vote.UnanimousBased.setDecisionVoters()方法的一些代码示例,展示了UnanimousBased.setDecisionVoters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UnanimousBased.setDecisionVoters()方法的具体详情如下:
包路径:org.springframework.security.access.vote.UnanimousBased
类名称:UnanimousBased
方法名:setDecisionVoters

UnanimousBased.setDecisionVoters介绍

暂无

代码示例

代码示例来源:origin: sk.seges.acris/acris-security-spring

@Bean
public UnanimousBased unanonimousDecisionManager() {
  UnanimousBased decisionManager = new UnanimousBased();
  decisionManager.setAllowIfAllAbstainDecisions(true);
  List<AccessDecisionVoter> decissionVoters = new ArrayList<AccessDecisionVoter>();
  decissionVoters.add(roleVoter());
  decisionManager.setDecisionVoters(decissionVoters);
  return decisionManager;
}

代码示例来源:origin: org.codehaus.fabric3/fabric3-spring-security

@Init
public void init() throws SecurityInitException {
  if (getDecisionVoters() == null || getDecisionVoters().isEmpty()) {
    List<AccessDecisionVoter> voters = new ArrayList<AccessDecisionVoter>();
    RoleVoter roleVoter = new RoleVoter();
    voters.add(roleVoter);
    AuthenticatedVoter authenticatedVoter = new AuthenticatedVoter();
    voters.add(authenticatedVoter);
    setDecisionVoters(voters);
  }
  if ("affirmative".equals(managerType)) {
    AffirmativeBased affirmativeBased = new AffirmativeBased();
    affirmativeBased.setDecisionVoters(getDecisionVoters());
    delegate = affirmativeBased;
  } else if ("consensus".equals(managerType)) {
    ConsensusBased consensusBased = new ConsensusBased();
    consensusBased.setDecisionVoters(getDecisionVoters());
    delegate = consensusBased;
  } else if ("unanimous".equals(managerType)) {
    UnanimousBased unanimousBased = new UnanimousBased();
    unanimousBased.setDecisionVoters(getDecisionVoters());
    delegate = unanimousBased;
  } else {
    throw new SecurityInitException("Unknown access decision manager type: " + managerType);
  }
}

相关文章