记得上下班打卡 | git大法好,push需谨慎

Commit d19a9ff0 authored by 张国柄's avatar 张国柄

fix token;

parent 32e0cd59
...@@ -24,8 +24,6 @@ public class JwtValidator { ...@@ -24,8 +24,6 @@ public class JwtValidator {
private Long refreshTtl; private Long refreshTtl;
private Long blacklistGracePeriod; private Long blacklistGracePeriod;
SecretKey secretKey = new SecretKeySpec(secret.getBytes(), SignatureAlgorithm.HS256.getJcaName());
// private static final long EXPIRE_TIME = 15 * 60 * 1000; // private static final long EXPIRE_TIME = 15 * 60 * 1000;
// private static final String TOKEN_SECRET = "qZHglvNP0n0aOOckHiQXq5JMD468J4eG"; // private static final String TOKEN_SECRET = "qZHglvNP0n0aOOckHiQXq5JMD468J4eG";
...@@ -44,7 +42,7 @@ public class JwtValidator { ...@@ -44,7 +42,7 @@ public class JwtValidator {
.setClaims(claimsMap) .setClaims(claimsMap)
.setIssuedAt(new Date(nowMillis)) .setIssuedAt(new Date(nowMillis))
.setExpiration(new Date(expMillis)) .setExpiration(new Date(expMillis))
.signWith(SignatureAlgorithm.HS256, secretKey); .signWith(SignatureAlgorithm.HS256, new SecretKeySpec(secret.getBytes(), SignatureAlgorithm.HS256.getJcaName()));
return builder.compact(); return builder.compact();
} }
...@@ -56,7 +54,7 @@ public class JwtValidator { ...@@ -56,7 +54,7 @@ public class JwtValidator {
*/ */
public Claims parse(String token) { public Claims parse(String token) {
return Jwts.parser() return Jwts.parser()
.setSigningKey(secretKey) .setSigningKey(new SecretKeySpec(secret.getBytes(), SignatureAlgorithm.HS256.getJcaName()))
.parseClaimsJws(token).getBody(); .parseClaimsJws(token).getBody();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment