Skip to content

Commit

Permalink
Merge pull request #87 from Mojacknong/fix_82/클라우드-이전
Browse files Browse the repository at this point in the history
[fix] 토큰 이슈, 만료일 설정 코드 변경
  • Loading branch information
MinchoGreenT authored Aug 18, 2024
2 parents 0aef522 + 085c98f commit dbb67f8
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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();

Expand Down

0 comments on commit dbb67f8

Please sign in to comment.