|
@@ -12,6 +12,8 @@ import cn.hutool.core.util.ReflectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.tourism.common.core.cache.CacheConfig;
|
|
|
import com.tourism.common.core.constant.ApplicationConstant;
|
|
|
import com.tourism.common.core.constant.ErrorCodeEnum;
|
|
@@ -22,6 +24,7 @@ import com.tourism.common.core.util.AopTargetUtil;
|
|
|
import com.tourism.common.core.util.MyCommonUtil;
|
|
|
import com.tourism.common.core.util.RedisKeyUtil;
|
|
|
import com.tourism.common.satoken.annotation.SaTokenDenyAuth;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.redisson.api.RMap;
|
|
|
import org.redisson.api.RSet;
|
|
|
import org.redisson.api.RTopic;
|
|
@@ -48,6 +51,7 @@ import java.util.*;
|
|
|
* @author 吃饭睡觉
|
|
|
* @date 2024-09-06
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Component
|
|
|
public class SaTokenUtil {
|
|
|
|
|
@@ -119,12 +123,21 @@ public class SaTokenUtil {
|
|
|
}
|
|
|
Method method = ((HandlerMethod) handler).getMethod();
|
|
|
String errorMessage;
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
//如果没有登录则直接交给satoken注解去验证。
|
|
|
if (!StpUtil.isLogin()) {
|
|
|
// 如果此 Method 或其所属 Class 标注了 @SaIgnore,则忽略掉鉴权
|
|
|
if (BooleanUtil.isTrue(SaStrategy.instance.isAnnotationPresent.apply(method, SaIgnore.class))) {
|
|
|
return ResponseResult.success();
|
|
|
}
|
|
|
+ try {
|
|
|
+// log.info("request::::::::{}", mapper.writeValueAsString(request));
|
|
|
+// log.info("handler::::::::{}", mapper.writeValueAsString(handler));
|
|
|
+ log.info("StpUtil::::::::getTokenInfo:::{}", mapper.writeValueAsString(StpUtil.getTokenInfo()));
|
|
|
+// log.info("StpUtil::::::::getTokenSession:::{}", mapper.writeValueAsString(StpUtil.getTokenSession()));
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
errorMessage = "非免登录接口必须包含Token信息!";
|
|
|
return ResponseResult.error(HttpServletResponse.SC_UNAUTHORIZED, ErrorCodeEnum.UNAUTHORIZED_LOGIN, errorMessage);
|
|
|
}
|