mirror of https://gitee.com/topiam/eiam
⚡ 优化
parent
45ecbfd668
commit
e14f2bd853
|
@ -23,13 +23,12 @@ import java.security.PublicKey;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import cn.topiam.employee.common.util.X509Utils;
|
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import io.jsonwebtoken.*;
|
import io.jsonwebtoken.*;
|
||||||
|
import static cn.topiam.employee.support.util.CertUtils.readPublicKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JWT 工具类
|
* JWT 工具类
|
||||||
|
@ -52,7 +51,7 @@ public class JwtUtils {
|
||||||
*/
|
*/
|
||||||
public static Claims parserToken(String token, String publicKey) {
|
public static Claims parserToken(String token, String publicKey) {
|
||||||
try {
|
try {
|
||||||
PublicKey readPublicKey = X509Utils.readPublicKey(publicKey, "");
|
PublicKey readPublicKey = readPublicKey(publicKey, "");
|
||||||
JwtParser jwtParser = Jwts.parser().verifyWith(readPublicKey).build();
|
JwtParser jwtParser = Jwts.parser().verifyWith(readPublicKey).build();
|
||||||
// 解析 JWT
|
// 解析 JWT
|
||||||
return jwtParser.parseSignedClaims(token).getPayload();
|
return jwtParser.parseSignedClaims(token).getPayload();
|
||||||
|
|
Loading…
Reference in New Issue