springboot 集成spring security后 url拦截问题
发布网友
发布时间:2022-04-10 23:55
我来回答
共1个回答
热心网友
时间:2022-04-11 01:24
AbstractAccessDecisionManager的子类使用了decide这个方法,你需要看AbstractAccessDecisionManager里面对于voter的结果如何处理的.
比如UnanimousBased.class
```
for (ConfigAttribute attribute : attributes) {
singleAttributeList.set(0, attribute);
for (AccessDecisionVoter voter : getDecisionVoters()) {
int result = voter.vote(authentication, object, singleAttributeList);
if (logger.isDebugEnabled()) {
logger.debug("Voter: " + voter + ", returned: " + result);
}
switch (result) {
case AccessDecisionVoter.ACCESS_GRANTED:
grant++;
break;
case AccessDecisionVoter.ACCESS_DENIED:
throw new AccessDeniedException(messages.getMessage(
"AbstractAccessDecisionManager.accessDenied",
"Access is denied"));
default:
abstain++;
break;
}
}
}
// To get this far, there were no deny votes
if (grant > 0) {
return;
}
```
主要看这边处理的....