|
|
|
@@ -40,6 +40,10 @@ public class JwtTokenUtil implements Serializable { |
|
|
|
@Value("${jwt.refresh-expiration-days:30}") |
|
|
|
private int refreshExpirationDays = 30; |
|
|
|
|
|
|
|
/** Allow up to this many seconds of clock skew so tokens that just expired still parse (reduces boundary failures). */ |
|
|
|
@Value("${jwt.clock-skew-seconds:30}") |
|
|
|
private long clockSkewSeconds = 30; |
|
|
|
|
|
|
|
private static final Key secretKey = Keys.secretKeyFor(SignatureAlgorithm.HS512); |
|
|
|
|
|
|
|
// retrieve username from jwt token |
|
|
|
@@ -59,7 +63,12 @@ public class JwtTokenUtil implements Serializable { |
|
|
|
|
|
|
|
// for retrieveing any information from token we will need the secret key |
|
|
|
private Claims getAllClaimsFromToken(String token) { |
|
|
|
return Jwts.parserBuilder().setSigningKey(secretKey).build().parseClaimsJws(token).getBody(); |
|
|
|
return Jwts.parserBuilder() |
|
|
|
.setSigningKey(secretKey) |
|
|
|
.setAllowedClockSkewSeconds(clockSkewSeconds) |
|
|
|
.build() |
|
|
|
.parseClaimsJws(token) |
|
|
|
.getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
// check if the token has expired |
|
|
|
|