From 2cbd23d061be5076b86771750bf17615bbecb57d Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 17 七月 2024 11:41:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- server/service/src/main/java/com/doumee/config/Jwt/WebMvcConfig.java | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 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 a5b106c..8fd806c 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 @@ -13,6 +13,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 +41,12 @@ @Autowired private RedisTemplate<String,Object> redisTemplate; + + /** + * 鏄惁寮�鍙戣�� + */ + @Value("${debug_model}") + private Boolean isDebug; /** * 娣诲姞鎷︽埅鍣� @@ -111,6 +118,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳"); } request.setAttribute(JwtTokenUtil.UserId_Name, memberId); + request.setAttribute(JwtTokenUtil.UserType, Constants.CUSTOMER); return true; } catch (IllegalArgumentException | JwtException e) { throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�"); @@ -120,6 +128,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) { @@ -142,6 +153,7 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛宸茬鐢�,璇疯仈绯荤鐞嗗憳"); } request.setAttribute(JwtTokenUtil.UserId_Name, userId); + request.setAttribute(JwtTokenUtil.UserType, Constants.BUSINESS); return true; } catch (IllegalArgumentException | JwtException e) { throw new BusinessException(ResponseStatus.NO_LOGIN.getCode(),"鏈櫥褰�"); -- Gitblit v1.9.3