|
@@ -27,23 +27,12 @@ public class AppUserLoginAspect {
|
|
|
public void checkLogin() {}
|
|
|
|
|
|
@Before("checkLogin()")
|
|
|
- public void doCheckLogin(JoinPoint joinPoint) throws Throwable {
|
|
|
- // 获取请求信息
|
|
|
- HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
-
|
|
|
-// // 获取Token
|
|
|
-// String token = request.getHeader("Authorization");
|
|
|
-// System.out.println("(AppUserLoginAspect) token = " + token);
|
|
|
-// jwtUtil.extractAllClaims(token);
|
|
|
- SecurityAppUserInfo userInfo = SecurityUtil.getAppUserInfo();
|
|
|
- String tokenRole = Convert.toStr(userInfo.getRole());
|
|
|
+ public void doCheckLogin(JoinPoint joinPoint) {
|
|
|
+ SecurityAppUserInfo securityAppUserInfo = SecurityUtil.getAppUserInfo();
|
|
|
+ String tokenRole = Convert.toStr(securityAppUserInfo.getRole());
|
|
|
if (!"APP_USER".equals(tokenRole)) {
|
|
|
throw new CustException("当前接口与 Token 的类型不匹配");
|
|
|
}
|
|
|
- System.out.println(userInfo);
|
|
|
-
|
|
|
-// if (token == null) throw new CustException("未登录或Token无效");
|
|
|
-
|
|
|
-
|
|
|
+ System.out.println(securityAppUserInfo);
|
|
|
}
|
|
|
}
|