fix: use new jwt header name to fix nginx remove header bug #910

This commit is contained in:
tjq 2024-07-08 23:44:58 +08:00
parent 3edaae67dd
commit c04cb08390
2 changed files with 5 additions and 1 deletions

View File

@ -39,7 +39,8 @@ public class AuthConstants {
* JWT key * JWT key
* 前端 header 默认首字母大写保持一致方便处理 * 前端 header 默认首字母大写保持一致方便处理
*/ */
public static final String JWT_NAME = "Power_jwt"; public static final String OLD_JWT_NAME = "Power_jwt";
public static final String JWT_NAME = "PowerJwt";
/** /**
* 前端跳转到指定页面指令 * 前端跳转到指定页面指令

View File

@ -216,6 +216,9 @@ public class PowerJobLoginServiceImpl implements PowerJobLoginService {
private Optional<JwtBody> parseJwt(HttpServletRequest httpServletRequest) { private Optional<JwtBody> parseJwt(HttpServletRequest httpServletRequest) {
// headercookie 都能获取 // headercookie 都能获取
String jwtStr = HttpServletUtils.fetchFromHeader(AuthConstants.JWT_NAME, httpServletRequest); String jwtStr = HttpServletUtils.fetchFromHeader(AuthConstants.JWT_NAME, httpServletRequest);
if (StringUtils.isEmpty(jwtStr)) {
jwtStr = HttpServletUtils.fetchFromHeader(AuthConstants.OLD_JWT_NAME, httpServletRequest);
}
/* /*