Commit e558df8f by guojuxing

权限拦截代码修改

parent 9826b8c8
......@@ -13,6 +13,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
......@@ -20,8 +21,14 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
private static final Logger log = LogManager.getLogger(AuthInterceptor.class);
private String[] ignoreURI = new String[] { "/gic-auth-web/login", "/gic-auth-web/logout", "/gic-auth-web/list-enterprise-by-phone",
"/gic-auth-web/login-user-menu", "/gic-auth-web/login-user-operation-item"};
private static final Map<String, Object> ignoreUriMap = new HashMap<>(16);
static {
ignoreUriMap.put("/gic-auth-web/login", "1");
ignoreUriMap.put("/gic-auth-web/logout", "1");
ignoreUriMap.put("/gic-auth-web/list-enterprise-by-phone", "1");
ignoreUriMap.put("/gic-auth-web/login-user-menu", "1");
ignoreUriMap.put("/gic-auth-web/login-user-operation-item", "1");
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {
......@@ -33,10 +40,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
String uri = request.getRequestURI();
log.info("用户接口访问路由:{}", uri);
//不需要拦截的路径
for (int i = 0; i < ignoreURI.length; i++) {
if (uri.contains(ignoreURI[i])) {
return true;
}
if (ignoreUriMap.containsKey(uri)) {
return true;
}
//判断是否有权限的路径
UserDetail userDetail = UserDetailUtils.getUserDetail();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment