@@ -0,0 +1,1721 @@
+package com.lance.shiro.config;%0A%0Aimport java.io.IOException;%0Aimport java.util.List;%0A%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse;%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport org.apache.commons.lang3.StringUtils;%0Aimport org.apache.shiro.SecurityUtils;%0Aimport org.apache.shiro.subject.Subject;%0Aimport org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Component;%0A%0Aimport com.lance.shiro.service.UserService;%0A%0A@Component(%22urlPermissionsFilter%22)%0Apublic class URLPermissionsFilter extends PermissionsAuthorizationFilter%7B%0A%09@Autowired%0A%09private UserService userService;%0A%0A%09@Override%0A%09public boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws IOException %7B%0A%09%09String curUrl = getRequestUrl(request);%0A%09%09Subject subject = SecurityUtils.getSubject();%0A%09%09if(subject.getPrincipal() == null %0A%09%09%09%09%7C%7C StringUtils.endsWithAny(curUrl, %22.js%22,%22.css%22,%22.html%22)%0A%09%09%09%09%7C%7C StringUtils.endsWithAny(curUrl, %22.jpg%22,%22.png%22,%22.gif%22, %22.jpeg%22)%0A%09%09%09%09%7C%7C StringUtils.equals(curUrl, %22/unauthor%22)) %7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09List%3CString%3E urls = userService.findPermissionUrl(subject.getPrincipal().toString());%0A%09%09%0A%09%09return urls.contains(curUrl);%0A%09%7D%0A%09%0A%09/**%0A%09 * %E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8DURL+Parameter%0A%09 * @author lance%0A%09 * @since  2014%E5%B9%B412%E6%9C%8818%E6%97%A5 %E4%B8%8B%E5%8D%883:09:26%0A%09 * @param request%09%E6%8B%A6%E6%88%AA%E8%AF%B7%E6%B1%82request%0A%09 * @return%09%09%09%E8%BF%94%E5%9B%9E%E5%AE%8C%E6%95%B4URL%0A%09 */%0A%09private String getRequestUrl(ServletRequest request) %7B%0A%09%09HttpServletRequest req = (HttpServletRequest)request;%0A%09%09String queryString = req.getQueryString();%0A%0A%09%09queryString = StringUtils.isBlank(queryString)?%22%22: %22?%22+queryString;%0A%09%09return req.getRequestURI()+queryString;%0A%09%7D%0A%7D%0A

add url filter