From 2d9cfa55f0f839ff464b445a259839ab6490d135 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 17 七月 2024 22:22:41 +0800
Subject: [PATCH] 提交
---
server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java b/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
index 00d3a0d..f856bca 100644
--- a/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
+++ b/server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.doumee.biz.system.SystemDictDataBiz;
+import com.doumee.biz.zbom.model.zhongtai.ZTConstants;
import com.doumee.config.annotation.UserLoginRequired;
import com.doumee.config.annotation.LoginRequired;
import com.doumee.core.constants.ResponseStatus;
@@ -13,6 +14,7 @@
import io.jsonwebtoken.JwtException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
@@ -40,6 +42,12 @@
@Autowired
private RedisTemplate<String,Object> redisTemplate;
+
+ /**
+ * 鏄惁寮�鍙戣��
+ */
+ @Value("${debug_model}")
+ private Boolean isDebug;
/**
* 娣诲姞鎷︽埅鍣�
@@ -111,7 +119,7 @@
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳");
}
request.setAttribute(JwtTokenUtil.UserId_Name, memberId);
- request.setAttribute(JwtTokenUtil.UserType, Constants.CUSTOMER);
+ request.setAttribute(JwtTokenUtil.UserType, ZTConstants.CUSTOMER);
return true;
} catch (IllegalArgumentException | JwtException e) {
throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�");
@@ -121,6 +129,9 @@
public Boolean checkPersonnelLogin(HttpServletRequest request, HttpServletResponse response){
String token = request.getHeader(JwtTokenUtil.HEADER_KEY);
try {
+ if(isDebug){
+ return true;
+ }
//鍒ゆ柇Token鏄惁瓒呮椂
boolean expiration = JwtTokenUtil.isTokenExpired(token);
if (expiration) {
@@ -143,7 +154,7 @@
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳");
}
request.setAttribute(JwtTokenUtil.UserId_Name, userId);
- request.setAttribute(JwtTokenUtil.UserType, Constants.BUSINESS);
+ request.setAttribute(JwtTokenUtil.UserType, ZTConstants.BUSINESS);
return true;
} catch (IllegalArgumentException | JwtException e) {
throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�");
--
Gitblit v1.9.3