diff --git a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java index d796b98..24bfbaf 100644 --- a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java +++ b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java @@ -49,11 +49,10 @@ public String createAccessToken(Long userId, String roles) { // 토 Claims claims = Jwts.claims().setSubject(String.valueOf(userId)); claims.put("roles", roles); - Date now = new Date(); String token = Jwts.builder() .setClaims(claims) - .setIssuedAt(now) - .setExpiration(new Date(now.getTime() + accessTokenTime)) + .setIssuedAt(new Date(System.currentTimeMillis())) + .setExpiration(new Date(System.currentTimeMillis() + accessTokenTime)) .signWith(SignatureAlgorithm.HS256, secretKey) // 암호화 알고리즘, secret 값 세팅 .compact(); @@ -64,11 +63,10 @@ public String createAccessToken(Long userId, String roles) { // 토 public String createRefreshToken(Long userId) { // 토큰 생성 Claims claims = Jwts.claims().setSubject(String.valueOf(userId)); - Date now = new Date(); String token = Jwts.builder() .setClaims(claims) - .setIssuedAt(now) - .setExpiration(new Date(now.getTime() + refreshTokenTime)) + .setIssuedAt(new Date(System.currentTimeMillis())) + .setExpiration(new Date(System.currentTimeMillis() + refreshTokenTime)) .signWith(SignatureAlgorithm.HS256, secretKey) // 암호화 알고리즘, secret 값 세팅 .compact();