Spring Boot 3 & Security 6 시리즈: JWT Util 클래스 작성 (7편)
·
Spring/Spring Security
JWT 유틸리티 클래스 작성하기 1. JWT - Util 클래스 작성하기 이 코드는 JWT(JSON Web Token)를 생성하고 검증하는 데 사용되는 TokenUtils 클래스에 대한 것이다. 클래스는 여러 메서드를 포함하고 있으며, JWT의 생성, 유효성 검증 및 관련 정보 추출과 같은 다양한 기능을 수행한다. @Slf4j @Component public class TokenUtils { private static final String jwtSecretKey = "thisIsASecretKeyUsedForJwtTokenGenerationAndItIsLongEnoughToMeetTheRequirementOf256Bits"; // jwtSecretKey를 바이트 배열로 변환하고, 이를 사용하여 HMAC..