Skip to content

Commit

Permalink
Merge pull request #156 from JNU-econovation/feat-cookie
Browse files Browse the repository at this point in the history
fix: prefix로 인한 JSON parser Exception 픽스
  • Loading branch information
pyg410 authored Apr 11, 2024
2 parents 400fe7a + 021e9b6 commit 21f59eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public WrapLoginResDTO login(HttpServletResponse response, LoginReqDTO loginReqD

// header 생성
RefreshToken refreshToken = refreshTokenService.createRefreshToken(member);
Instant accessTokenExpiration = JwtProvider.getExpiration(accessToken);
Instant accessTokenExpiration = JwtProvider.getATExpiration(accessToken);
Instant refreshTokenExpiration = JwtProvider.getExpiration(refreshToken.getToken());

HttpHeaders httpHeaders = new HttpHeaders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public static String cutTokenPrefix(String bearerToken) {
}

public static Claims getClaims(String token) {
return Jwts.parser()
.setSigningKey(secretKey)
.parseClaimsJws(token)
.getBody();
}

public static Claims getATClaims(String token){
return Jwts.parser()
.setSigningKey(secretKey)
.parseClaimsJws(cutTokenPrefix(token))
Expand All @@ -63,4 +70,9 @@ public static Instant getExpiration(String token) {
.getExpiration()
.toInstant();
}
public static Instant getATExpiration(String token){
return getATClaims(token)
.getExpiration()
.toInstant();
}
}

0 comments on commit 21f59eb

Please sign in to comment.