mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 海南平台对接
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user