springSecurity开发中问题总结

1、security中的securityMetadataSource拦截 再到AccessDecisionManager。

如果securityMetadataSource类中的getAttributes方法返回的是null,则不会进入AccessDecisionManager中。

注意:

 1 public Collection<ConfigAttribute> getAttributes(Object object)
 2             throws IllegalArgumentException {
 3         String requestUrl = ((FilterInvocation) object).getRequestUrl();
 4         if(menuMap == null) {
 5             loadResourceDefine();
 6         }
 7 //此处一定要注意添加!!!!
 8         if(!StringUtils.isEmpty(requestUrl)&&requestUrl.length() > 0){
 9             requestUrl = requestUrl.substring(1,requestUrl.length());
10         }
11 //        log.debug("这是 security metadata source中 getAttribute 的返回: " + menuMap.get(requestUrl) +"此时的url为:" + requestUrl);
12         return menuMap.get(requestUrl);
13     }
原文地址:https://www.cnblogs.com/xuzhenmin/p/3530815.html