本文整理了Java中org.springframework.security.access.vote.UnanimousBased
类的一些代码示例,展示了UnanimousBased
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UnanimousBased
类的具体详情如下:
包路径:org.springframework.security.access.vote.UnanimousBased
类名称:UnanimousBased
[英]Simple concrete implementation of org.springframework.security.access.AccessDecisionManager that requires all voters to abstain or grant access.
[中]org的简单具体实现。springframework。安全通道AccessDecisionManager,要求所有投票者弃权或授予访问权限。
代码示例来源:origin: spring-projects/spring-security
private UnanimousBased makeDecisionManager() {
RoleVoter roleVoter = new RoleVoter();
DenyVoter denyForSureVoter = new DenyVoter();
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
List<AccessDecisionVoter<? extends Object>> voters = new Vector<AccessDecisionVoter<? extends Object>>();
voters.add(roleVoter);
voters.add(denyForSureVoter);
voters.add(denyAgainForSureVoter);
return new UnanimousBased(voters);
}
代码示例来源:origin: spring-projects/spring-security
singleAttributeList.set(0, attribute);
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
checkAllowIfAllAbstainDecisions();
代码示例来源:origin: spring-projects/spring-security
@Test
public void testThreeAbstainVotesGrantsAccessWithoutDefault() throws Exception {
TestingAuthenticationToken auth = makeTestToken();
UnanimousBased mgr = makeDecisionManager();
mgr.setAllowIfAllAbstainDecisions(true);
assertThat(mgr.isAllowIfAllAbstainDecisions()).isTrue(); // check changed
List<ConfigAttribute> config = SecurityConfig.createList("IGNORED_BY_ALL");
mgr.decide(auth, new Object(), config);
}
代码示例来源: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: sk.seges.acris/acris-security-spring
@Bean
public UnanimousBased businessAccessDecisionManager() {
UnanimousBased voter = new UnanimousBased();
voter.setAllowIfAllAbstainDecisions(true);
List<AccessDecisionVoter> decissionVoters = new ArrayList<AccessDecisionVoter>();
decissionVoters.add(roleVoter);
decissionVoters.add(aclObjectReadVoter());
decissionVoters.add(aclObjectWriteVoter());
decissionVoters.add(aclObjectDeleteVoter());
decissionVoters.add(aclEntryListReadVoter());
decissionVoters.add(aclEntryListWriteVoter());
decissionVoters.add(aclEntryListDeleteVoter());
return voter;
}
代码示例来源: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);
}
}
代码示例来源:origin: spring-projects/spring-security
private UnanimousBased makeDecisionManagerWithFooBarPrefix() {
RoleVoter roleVoter = new RoleVoter();
roleVoter.setRolePrefix("FOOBAR_");
DenyVoter denyForSureVoter = new DenyVoter();
DenyAgainVoter denyAgainForSureVoter = new DenyAgainVoter();
List<AccessDecisionVoter<? extends Object>> voters = new Vector<AccessDecisionVoter<? extends Object>>();
voters.add(roleVoter);
voters.add(denyForSureVoter);
voters.add(denyAgainForSureVoter);
return new UnanimousBased(voters);
}
代码示例来源:origin: org.springframework.security/spring-security-core
singleAttributeList.set(0, attribute);
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
checkAllowIfAllAbstainDecisions();
代码示例来源:origin: org.springframework.webflow/spring-webflow
private AbstractAccessDecisionManager createManager(SecurityRule rule) {
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
voters.add(new RoleVoter());
if (rule.getComparisonType() == SecurityRule.COMPARISON_ANY) {
return new AffirmativeBased(voters);
} else if (rule.getComparisonType() == SecurityRule.COMPARISON_ALL) {
return new UnanimousBased(voters);
} else {
throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
}
}
代码示例来源:origin: apache/servicemix-bundles
singleAttributeList.set(0, attribute);
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
checkAllowIfAllAbstainDecisions();
代码示例来源:origin: yidongnan/grpc-spring-boot-starter
@Bean
AccessDecisionManager accessDecisionManager() {
final List<AccessDecisionVoter<?>> voters = new ArrayList<>();
voters.add(new AccessPredicateVoter());
return new UnanimousBased(voters);
}
代码示例来源:origin: org.springframework.security/org.springframework.security.core
singleAttributeList.set(0, attribute);
for(AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
checkAllowIfAllAbstainDecisions();
代码示例来源:origin: spring-projects/spring-webflow
private AbstractAccessDecisionManager createManager(SecurityRule rule) {
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
voters.add(new RoleVoter());
if (rule.getComparisonType() == SecurityRule.COMPARISON_ANY) {
return new AffirmativeBased(voters);
} else if (rule.getComparisonType() == SecurityRule.COMPARISON_ALL) {
return new UnanimousBased(voters);
} else {
throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
}
}
代码示例来源:origin: org.springframework.statemachine/spring-statemachine-core
private AbstractAccessDecisionManager createDefaultTransitionManager(SecurityRule rule) {
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
voters.add(new TransitionExpressionVoter());
voters.add(new TransitionVoter<Object, Object>());
voters.add(new RoleVoter());
if (rule.getComparisonType() == SecurityRule.ComparisonType.ANY) {
return new AffirmativeBased(voters);
} else if (rule.getComparisonType() == SecurityRule.ComparisonType.ALL) {
return new UnanimousBased(voters);
} else if (rule.getComparisonType() == SecurityRule.ComparisonType.MAJORITY) {
return new ConsensusBased(voters);
} else {
throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
}
}
代码示例来源:origin: org.springframework.statemachine/spring-statemachine-core
private AbstractAccessDecisionManager createDefaultEventManager(SecurityRule rule) {
List<AccessDecisionVoter<? extends Object>> voters = new ArrayList<AccessDecisionVoter<? extends Object>>();
voters.add(new EventExpressionVoter<Object>());
voters.add(new EventVoter<Object>());
voters.add(new RoleVoter());
if (rule.getComparisonType() == SecurityRule.ComparisonType.ANY) {
return new AffirmativeBased(voters);
} else if (rule.getComparisonType() == SecurityRule.ComparisonType.ALL) {
return new UnanimousBased(voters);
} else if (rule.getComparisonType() == SecurityRule.ComparisonType.MAJORITY) {
return new ConsensusBased(voters);
} else {
throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
}
}
内容来源于网络,如有侵权,请联系作者删除!