Skip to content

feat: 회원 탈퇴 기능 구현 - #22

Merged
popeye0618 merged 2 commits into
mainfrom
feat/member-withdrawal-policy
May 14, 2026
Merged

feat: 회원 탈퇴 기능 구현#22
popeye0618 merged 2 commits into
mainfrom
feat/member-withdrawal-policy

Conversation

@popeye0618

@popeye0618 popeye0618 commented May 14, 2026

Copy link
Copy Markdown
Contributor

📌 작업 개요

회원 탈퇴 기능 구현

🔗 관련 이슈

  • Closes #

✨ 변경 사항

  • MemberWithdrawalService 및 UseCase를 생성하여 회원 탈퇴 로직 구현
  • 탈퇴 요청을 처리하는 MemberWithdrawalContext 및 Policy 인터페이스 추가
  • 탈퇴 시 회원 상태 변경 및 Refresh Token 폐기 처리 로직 추가
  • MemberController에 회원 탈퇴 엔드포인트(/me DELETE) 추가
  • API 문서 및 관련 단위 테스트/통합 테스트(MemberControllerTest, MemberDocsTest) 작성

🧪 테스트

  • 단위 테스트 추가/수정
  • 로컬에서 동작 확인

✅ 체크리스트

  • 브랜치명이 Git Flow 컨벤션을 따릅니다 (feature/, fix/, hotfix/ 등)
  • 커밋 메시지가 Conventional Commits 컨벤션을 따릅니다
  • 리뷰 가능한 단위로 작업을 분리했습니다
  • 관련 문서를 업데이트했습니다 (필요 시)

💬 리뷰어에게

@codex

- MemberWithdrawalService 및 UseCase를 생성하여 회원 탈퇴 로직 구현
- 탈퇴 요청을 처리하는 MemberWithdrawalContext 및 Policy 인터페이스 추가
- 탈퇴 시 회원 상태 변경 및 Refresh Token 폐기 처리 로직 추가
- MemberController에 회원 탈퇴 엔드포인트(`/me` DELETE) 추가
- API 문서 및 관련 단위 테스트/통합 테스트(MemberControllerTest, MemberDocsTest) 작성

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +35 to +36
member.withdraw(now)
refreshTokenUseCase.revokeAll(context.memberId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 탈퇴 시 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex review

- JwtAuthenticationValidationFilter로 요청 필터 계층에서 JWT 유효성 검증 로직 추가
- JwtAuthenticationValidator 인터페이스 정의로 검증 로직 확장성 확보
- MemberStatusJwtAuthenticationValidator 구현체로 회원 상태 기반 유효성 검증 추가
- SecurityConfig에 커스텀 JwtAuthenticationValidationFilter DI 및 필터 체인 등록
- MemberRepository에 회원 상태 조회 메서드(existsByIdAndStatusInAndDeletedAtIsNull) 추가
@popeye0618
popeye0618 merged commit c7e1449 into main May 14, 2026
1 check failed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +36 to +38
refreshTokenUseCase.revokeAll(context.memberId)

withdrawalPolicies.forEach { it.apply(context) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 탈퇴 후처리(apply)를 트랜잭션 커밋 이후로 분리하세요

withdrawalPolicies.apply를 현재 트랜잭션 안에서 실행하면, 어떤 정책이 외부 시스템(메시지 발행, 타 도메인 API 호출 등)에 부작용을 남긴 뒤 다음 정책에서 예외가 발생하는 경우 DB 트랜잭션은 롤백되지만 외부 부작용은 되돌릴 수 없어 회원 상태/토큰 상태와 외부 시스템 상태가 불일치할 수 있습니다. 특히 MemberWithdrawalPolicy 주석이 “탈퇴 확정 후 후처리”를 의도하고 있어 이 동작은 의도와도 어긋납니다. 핵심 탈퇴 처리(member.withdraw, revokeAll)와 후처리를 분리하고, 후처리는 afterCommit 훅 또는 outbox/event 방식으로 커밋 이후 실행되도록 변경하는 것이 안전합니다.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant