Spring/인증_인가 2

[Spring] JWT를 이용한 인증,인가 동작 원리

Spring - 인증 과정 (첫 로그인 과정) 1. 클라이언트 요청   - 클라이언트가 `/api/auth/login` 엔드포인트로 AuthRequest(username, password)를 POST 요청2. 내장 Tomcat 서버   - Tomcat 서버가 요청을 처리하여 AuthController로 전달합3. AuthController - authenticate 호출   - AuthController는 AuthenticationManager를 사용해 인증을 시도   - `authenticate()`메서드에 `UsernamePasswordAuthenticationToken`을 전달하여 인증을 위임4. AuthenticationManager   - AuthenticationManager는 사용자 인증을 ..

[Spring] JWT 구현 순서 with. Spring Security

최종 순서 요약이 순서를 따라가면 Spring Security와 JWT 기반 인증을 효율적이고 최신 방식으로 구현 가능!! 🚀User 엔티티와 리포지토리 구현: 사용자 데이터 저장 및 조회를 위한 기반.UserPrincipal과 CustomUserDetailsService 구현: Spring Security와 사용자 데이터 연동.JwtUtil 구현: JWT 생성, 검증, 파싱 로직JwtRequestFilter 구현: Spring Security 필터 체인에 JWT 기반 인증 추가.Spring Security 설정: 필터 체인, 세션 관리, 접근 제어 설정.인증 컨트롤러 구현: 로그인 및 JWT 발급/검증 API 제공. 1. User 엔티티와 리포지토리 구현목적: 애플리케이션에서 사용자 정보를 데이터베이..