배경
현재 서블릿 필터와 시리얼 넘버 기반의 단순 인증을 사용하는 상황. 클라이언트는 iOS/Android 모바일 앱만 존재하며, 소셜 로그인(카카오, 구글, 애플) 도입이 필요한 상황.
문제점
서블릿 필터 기반 인증은 Spring Security의 인증/인가 체계를 활용하지 못해 확장성이 떨어지는 상황
시리얼 넘버 기반 로그인은 소셜 계정 연동이 불가능한 상황
인증 실패 시 에러 응답을 필터에서 직접 문자열로 작성하고 있는 상황
해결 방안
Spring Security SecurityFilterChain 기반 인증 구조로 전환
모바일 클라이언트가 OAuth access token을 서버에 전달하면, 서버가 프로바이더 API를 호출하여 사용자 정보를 검증하는 방식 적용
AuthenticationEntryPoint, AccessDeniedHandler를 통한 에러 처리 통합
트랜잭션 범위 최소화: 외부 OAuth API 호출은 트랜잭션 밖에서 수행하고, DB 조작만 @Transactional 적용 (AuthService → MemberService 클래스 분리)
작업 항목
Spring Security 의존성 추가
Member 도메인 모델 OAuth 필드로 변경 (serialNumber → providerType, providerId, email)
MemberEntity, MemberJpaRepository, MemberAdapter, MemberPort 반영
OAuth output port 및 프로바이더별 어댑터 구현 (Kakao, Google, Apple)
Spring Security 인프라 구성 (SecurityConfig, JwtSecurityFilter, JwtAuthenticationProvider)
인증/인가 에러 핸들러 구현 (JwtAuthenticationEntryPoint, JwtAccessDeniedHandler)
AuthController 소셜 로그인 엔드포인트 전환
AuthService / MemberService 책임 분리
기존 서블릿 필터 인증 코드 제거 및 security/ 패키지 통합
기존 테스트 코드 수정
배경
현재 서블릿 필터와 시리얼 넘버 기반의 단순 인증을 사용하는 상황. 클라이언트는 iOS/Android 모바일 앱만 존재하며, 소셜 로그인(카카오, 구글, 애플) 도입이 필요한 상황.
문제점
해결 방안
SecurityFilterChain기반 인증 구조로 전환AuthenticationEntryPoint,AccessDeniedHandler를 통한 에러 처리 통합@Transactional적용 (AuthService→MemberService클래스 분리)작업 항목
Member도메인 모델 OAuth 필드로 변경 (serialNumber→providerType,providerId,email)MemberEntity,MemberJpaRepository,MemberAdapter,MemberPort반영SecurityConfig,JwtSecurityFilter,JwtAuthenticationProvider)JwtAuthenticationEntryPoint,JwtAccessDeniedHandler)AuthController소셜 로그인 엔드포인트 전환AuthService/MemberService책임 분리security/패키지 통합