瀏覽代碼

优化用户信息获取逻辑

zhouhao 8 年之前
父節點
當前提交
6700a9a498
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      hsweb-web-core/src/main/java/org/hsweb/web/core/authorize/AopAuthorizeValidator.java

+ 4 - 1
hsweb-web-core/src/main/java/org/hsweb/web/core/authorize/AopAuthorizeValidator.java

@@ -88,7 +88,10 @@ public class AopAuthorizeValidator extends SimpleAuthorizeValidator {
             HttpSession session = request.getSession(false);
             if (session == null) throw new AuthorizeException("未登录", 401);
             user = httpSessionManager.getUserBySessionId(session.getId());
-            if (user == null) throw new AuthorizeException("未登录", 401);
+            if (user == null)
+                user = (User) session.getAttribute("user");
+            if (user == null)
+                throw new AuthorizeException("未登录", 401);
         }
         if (config.isEmpty()) return true;
         Map<String, Object> param = new LinkedHashMap<>();