update 海南平台对接

This commit is contained in:
2024-01-25 16:00:35 +08:00
parent 77777b07ea
commit 6e37a276bf
8 changed files with 87 additions and 34 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.DatatypeConverter;
import java.security.Key;
import java.util.Date;
@@ -128,6 +129,11 @@ public class JWTUtils {
return claims.getId();
}
/**
* 校验第三方平台token
* @param token 第三方平台token
* @return
*/
public static boolean checkThirdPartyToken(String token) {
token = getToken(token);
if (StringUtils.isBlank(token)) {
@@ -137,6 +143,15 @@ public class JWTUtils {
return StringUtils.isNotBlank(claims.getId());
}
public static boolean checkThirdPartyToken(HttpServletRequest request) {
if (request == null) {
throw new BusinessException(ReturnCodeEnum.CODE_TOKEN_ERROR);
}
// 校验令牌
String token = request.getHeader("Authorization");
return checkThirdPartyToken(token);
}
/**
* 替换Bearer
*