Commit 7300e49b by 陶光胜

Merge branch 'developer' into 'master'

有些免登录需要用到session数据

See merge request !6
parents 8fad1544 84dc7832
...@@ -73,18 +73,20 @@ public class AuthInterceptor extends HandlerInterceptorAdapter { ...@@ -73,18 +73,20 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
} }
//判断是否有权限的路径 //判断是否有权限的路径
UserDetail userDetail = UserContext.getContext().getByRedis(); UserDetail userDetail = UserContext.getContext().getByRedis();
if (userDetail == null || userDetail.getUserInfo() == null) {
throw new CommonException(ErrorCode.LOGIN_INVALID.getErrorCode(), "登录信息不存在,请登录");
}
request.setAttribute("user", userDetail);
HandlerMethod handler = (HandlerMethod) object; HandlerMethod handler = (HandlerMethod) object;
//免登录接口路由 //免登录接口路由
IgnoreLogin ignoreLogin = handler.getMethodAnnotation(IgnoreLogin.class); IgnoreLogin ignoreLogin = handler.getMethodAnnotation(IgnoreLogin.class);
if (null != ignoreLogin) { if (null != ignoreLogin) {
//有些免登录需要用到session数据
request.setAttribute("user", userDetail);
return true; return true;
} }
if (userDetail == null || userDetail.getUserInfo() == null) {
throw new CommonException(ErrorCode.LOGIN_INVALID.getErrorCode(), "登录信息不存在,请登录");
}
request.setAttribute("user", userDetail);
//不需要拦截的路径 //不需要拦截的路径
if (ignoreUriAfterLoginMap.containsKey(uri)) { if (ignoreUriAfterLoginMap.containsKey(uri)) {
......
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