feat: 회원 탈퇴 기능 구현 - #22
Conversation
- MemberWithdrawalService 및 UseCase를 생성하여 회원 탈퇴 로직 구현 - 탈퇴 요청을 처리하는 MemberWithdrawalContext 및 Policy 인터페이스 추가 - 탈퇴 시 회원 상태 변경 및 Refresh Token 폐기 처리 로직 추가 - MemberController에 회원 탈퇴 엔드포인트(`/me` DELETE) 추가 - API 문서 및 관련 단위 테스트/통합 테스트(MemberControllerTest, MemberDocsTest) 작성
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5cbe2d1ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| member.withdraw(now) | ||
| refreshTokenUseCase.revokeAll(context.memberId) |
There was a problem hiding this comment.
탈퇴 시 Access Token 즉시 무효화 경로를 추가하세요
MemberWithdrawalService.withdraw()는 회원 상태 변경 후 revokeAll()로 Refresh Token만 폐기하고 끝나기 때문에, 이미 발급된 Access Token은 만료 시점까지 그대로 유효합니다. 확인 범위는 SecurityConfig.securityFilterChain(stateless JWT 검증만 수행)과 SchoolEmailVerificationService.request(회원 상태 재검증 없이 memberId로 처리)이며, 이 조합에서는 탈퇴 직후에도 기존 Access Token으로 인증 API 호출이 가능합니다. 탈퇴의 즉시성 보장을 위해 탈퇴 시점에 토큰 버전(token version) 증가/블랙리스트 등록을 하고 리소스 서버 검증 단계에서 이를 확인하거나, 최소한 주요 write API에서 회원 상태(deletedAt/status)를 재검증하도록 보완하는 것이 필요합니다.
Useful? React with 👍 / 👎.
- JwtAuthenticationValidationFilter로 요청 필터 계층에서 JWT 유효성 검증 로직 추가 - JwtAuthenticationValidator 인터페이스 정의로 검증 로직 확장성 확보 - MemberStatusJwtAuthenticationValidator 구현체로 회원 상태 기반 유효성 검증 추가 - SecurityConfig에 커스텀 JwtAuthenticationValidationFilter DI 및 필터 체인 등록 - MemberRepository에 회원 상태 조회 메서드(existsByIdAndStatusInAndDeletedAtIsNull) 추가
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7e144902d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| refreshTokenUseCase.revokeAll(context.memberId) | ||
|
|
||
| withdrawalPolicies.forEach { it.apply(context) } |
There was a problem hiding this comment.
탈퇴 후처리(apply)를 트랜잭션 커밋 이후로 분리하세요
withdrawalPolicies.apply를 현재 트랜잭션 안에서 실행하면, 어떤 정책이 외부 시스템(메시지 발행, 타 도메인 API 호출 등)에 부작용을 남긴 뒤 다음 정책에서 예외가 발생하는 경우 DB 트랜잭션은 롤백되지만 외부 부작용은 되돌릴 수 없어 회원 상태/토큰 상태와 외부 시스템 상태가 불일치할 수 있습니다. 특히 MemberWithdrawalPolicy 주석이 “탈퇴 확정 후 후처리”를 의도하고 있어 이 동작은 의도와도 어긋납니다. 핵심 탈퇴 처리(member.withdraw, revokeAll)와 후처리를 분리하고, 후처리는 afterCommit 훅 또는 outbox/event 방식으로 커밋 이후 실행되도록 변경하는 것이 안전합니다.
Useful? React with 👍 / 👎.
📌 작업 개요
회원 탈퇴 기능 구현
🔗 관련 이슈
✨ 변경 사항
/meDELETE) 추가🧪 테스트
✅ 체크리스트
feature/,fix/,hotfix/등)💬 리뷰어에게
@codex