본문 바로가기

전체 글3

정적 팩토리 메소드(Static Factory Method) 정적 팩토리 메소드란? 인스턴스를 생성자로 생성하지 않고 static 메소드로 생성하는 것. 자동차 브랜드와 색상을 필드로 가진 Car 클래스가 있다. 생성자를 통해 인스턴스를 생성 public class Car { private String brand; private String color; public Car(String brand, String color) { this.brand = brand; this.color = color; } } 정적 팩토리 메소드를 통해 인스턴스 생성 public class Car { private String brand; private String color; private Car(String brand, String color) { this.brand = brand; .. 2024. 3. 31.
JWT + Spring Security + Redis를 이용한 로그인 구현(2) 지난 1편에 이어 이번에는 JWT 발급 구현에 대해 적어보았습니다 !! https://whymecoding.tistory.com/2 JWT + Spring Security를 이용한 로그인 구현(1) Spring Security 의 구조 1. 클라이언트의 요청이 들어오면 AuthenticationFilter에서 이를 가로챈다. 2-3. 전달받은 클라이언트의 아이디 / 비밀번호 를 UsernamePasswordAuthenticationToken에 담는다. (인증 객체 생 whymecoding.tistory.com AccessToken & RefreshToken JWT 의 특징 중에는 무상태성(Stateless) 가 있습니다. 이는 서버가 토큰을 사용자에게 발급하고 나서 사용자의 상태를 저장하지 않음을 말합니.. 2023. 9. 8.
JWT + Spring Security를 이용한 로그인 구현(1) Spring Security 의 구조 1. 클라이언트의 요청이 들어오면 AuthenticationFilter에서 이를 가로챈다. 2-3. 전달받은 클라이언트의 아이디 / 비밀번호 를 UsernamePasswordAuthenticationToken에 담는다. (인증 객체 생성) 4. 이를 AutenticationManager를 이용하여 실제 인증을 구현하는 ProviderManager에 전달한다. 5. ProviderManager에 있는 AuthenticationProvider의 여러 인증 메서드 중 적절한 것을 사용 ( 별도 설정이 없을땐 Spring Security의 기본 설정에 의해 DaoAuthenticationProvider를 사용한다.) 6. DaoAuthenticationProvider가 Us.. 2023. 8. 31.