[FIX] UTC Clock

This commit is contained in:
Gravita 2022-03-18 19:54:56 +07:00
parent 736bf51eaa
commit f6ee175acd

View file

@ -6,6 +6,7 @@
import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.ECPublicKey; import java.security.interfaces.ECPublicKey;
import java.time.Clock;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
@ -27,6 +28,7 @@ public static String makeAccessJwtTokenFromString(User user, LocalDateTime expir
public static JwtTokenInfo getJwtInfoFromAccessToken(String token, ECPublicKey publicKey) { public static JwtTokenInfo getJwtInfoFromAccessToken(String token, ECPublicKey publicKey) {
var parser = Jwts.parserBuilder() var parser = Jwts.parserBuilder()
.requireIssuer("LaunchServer") .requireIssuer("LaunchServer")
.setClock(() -> new Date(Clock.systemUTC().millis()))
.setSigningKey(publicKey) .setSigningKey(publicKey)
.build(); .build();
var claims = parser.parseClaimsJws(token); var claims = parser.parseClaimsJws(token);