|
@@ -4,6 +4,7 @@ package com.jzg.commons.core.base;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
|
|
+import com.jzg.commons.exception.TokenExpireException;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import org.redisson.api.RedissonClient;
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -26,7 +27,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
@@ -42,7 +43,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
@@ -58,7 +59,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
List<String> userPerms = new ArrayList<>();
|
|
List<String> userPerms = new ArrayList<>();
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
@@ -79,7 +80,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
@@ -91,7 +92,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
@@ -107,7 +108,7 @@ public class BaseController {
|
|
|
HttpServletRequest request = attributes.getRequest();
|
|
HttpServletRequest request = attributes.getRequest();
|
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
String authorizationHeader = request.getHeader("Authorization");
|
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
if(Objects.isNull(authorizationHeader) || Objects.isNull(redissonClient.getBucket(authorizationHeader).get())){
|
|
|
- throw new SystemException("用户登录信息过期");
|
|
|
|
|
|
|
+ throw new TokenExpireException("用户登录信息过期");
|
|
|
}
|
|
}
|
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
String userJsonStr = redissonClient.getBucket(authorizationHeader).get().toString();
|
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|
|
JSONObject userInfo = JSONObject.parseObject(userJsonStr);
|