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..
Spring Boot 3 & Security 6 시리즈: JWT 검증 인터셉터 작성하기 (6편)
·
Spring/Spring Security
JwtToken의 유효성을 검증할 인터셉터 클래스를 작성하자 프로젝트 구성은 아래의 포스트에 있다.👇🏻👇🏻 Spring Boot3에서 Spring Security6 사용하기: SecurityConfig 클래스 작성하기 (2편) SpringBoot에서 Spring Security를 사용하는 방법을 알아보자 Spring security6의 FilterChain방식👇🏻👇🏻 Spring Security6 - Authentication(인증) 코딩은 글쓰기라고 생각한다. 꾸준히 기록하며 내 개발 실력을 키 curiousjinan.tistory.com 1. JwtTokenInterceptor - 인터셉터 클래스 설정 jwtTokenInterceptor는 Spring의 HandlerInterceptor 인터페이스를 ..