
[JWT] JWT Exception 처리
·
프로젝트/Archive
JWT의 토큰 만료를 확인하면서 HTTP 500 에러가 발생한다는 것을 확인했다. 요구사항에서 주어진 ERROR_CODE를 확인하면 토큰 에러의 경우에는 401, Unauthorized 에러를 반환하라고 지침하고 있기 때문에 토큰과 관련한 에러를 따로 잡아주는 과정이 필요할 것 같다. 첫 번째 시도 isExpired 메서드에서 try-catch @Slf4j public class JwtUtil { ... public static boolean isExpired(String token, String secretKey) { try { return Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token) .getBody().getExpiration().bef..