Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
ConfigAttributeDefinition config = new ConfigAttributeDefinition(getConfigAttributes(rule));
if (accessDecisionManager != null) {
accessDecisionManager.decide(authentication, object, config);
} else {
AbstractAccessDecisionManager abstractAccessDecisionManager;
List voters = new ArrayList();
voters.add(new RoleVoter());
if (rule.getComparisonType() == SecurityRule.COMPARISON_ANY) {
abstractAccessDecisionManager = new AffirmativeBased();
} else if (rule.getComparisonType() == SecurityRule.COMPARISON_ALL) {
abstractAccessDecisionManager = new UnanimousBased();
} else {
throw new IllegalStateException("Unknown SecurityRule match type: " + rule.getComparisonType());
}
abstractAccessDecisionManager.setDecisionVoters(voters);
abstractAccessDecisionManager.decide(authentication, object, config);
}
}