Skip to content

[Feat] 사용자 로그아웃 API (#178) - #207

Open
gichanGim wants to merge 2 commits into
developfrom
feat/#178/user-logout
Open

gichanGim wants to merge 2 commits into
developfrom
feat/#178/user-logout

Conversation

@gichanGim

@gichanGim gichanGim commented Sep 9, 2026

Copy link
Copy Markdown
Member

🔥 작업 내용 (What)

이번 PR에서 어떤 작업을 했는지 간단히 설명해주세요.

사용자 로그아웃 API를 구현하였습니다.
기존 어드민 로그아웃에 적용한 로직을 그대로 적용하였습니다.


🧩 변경 사항 (Details)

구체적인 변경 사항을 나열해주세요.

  • AuthController: /logout 엔드포인트 추가. Origin 검증 → 리프레시 쿠키 추출 → 폐기 → 쿠키 만료 (어드민 로그아웃과 동일 패턴)
  • UserAuthService.logout: 리프레시 타입·ROLE_USER만 수용, RefreshTokenStore.revoke로 세션 삭제
  • AuthSuccessCode.LOGOUT_SUCCESS (AUTH-205) 추가
  • docs/conventions/auth.md: "사용자 로그아웃 MVP 제외" 문구를 실제 구현 내용으로 갱신

📸 스크린샷

API 응답 / Swagger / 에러 화면 등이 있다면 첨부해주세요.


⚠️ 주의 사항 (Caution)

리뷰어가 꼭 알아야 할 사항이 있다면 적어주세요.


🔗 관련 이슈

관련된 이슈가 있다면 연결해주세요.
Closes #178


✅ 체크리스트

  • 로컬에서 빌드 및 테스트 완료
  • 테스트 결과 사진 첨부 완료
  • 코드 리뷰 반영 완료

Summary by CodeRabbit

  • 새 기능

    • 로그아웃 API가 정식 지원됩니다.
    • 로그아웃 시 리프레시 토큰과 Origin을 검증하고, 세션을 종료한 뒤 토큰 쿠키를 만료 처리합니다.
    • 로그아웃 성공 시 성공 응답을 제공합니다.
  • 문서

    • 인증 관련 문서와 보안 방어 설명에 로그아웃 동작이 반영되었습니다.

⚠️ Note: Your high-level summary instructions were not applied because this feature is currently available only on Essentials plans or higher.

@gichanGim
gichanGim requested a review from hwistlezz September 9, 2026 02:18
@gichanGim gichanGim self-assigned this Sep 9, 2026
@gichanGim gichanGim added the feat label Sep 9, 2026
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Free

Run ID: 6aa3bcc3-92b3-489a-b05a-505820892113

📥 Commits

Reviewing files that changed from the base of the PR and between 2a1e161 and 693e735.

📒 Files selected for processing (4)
  • docs/conventions/auth.md
  • src/main/java/org/sopt/hashi/auth/code/AuthSuccessCode.java
  • src/main/java/org/sopt/hashi/auth/internal/UserAuthService.java
  • src/main/java/org/sopt/hashi/auth/internal/web/AuthController.java

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

사용자 로그아웃 API를 추가했습니다. Origin과 리프레시 쿠키를 검증하고, 사용자 리프레시 세션을 폐기한 뒤 쿠키를 만료시킵니다. 액세스 JWT는 블랙리스트에 등록하지 않습니다.

Changes

사용자 로그아웃

Layer / File(s) Summary
리프레시 세션 폐기
src/main/java/org/sopt/hashi/auth/internal/UserAuthService.java, docs/conventions/auth.md
UserAuthService가 리프레시 토큰 유형과 USER 역할을 검증합니다. 검증에 성공하면 사용자 리프레시 세션을 폐기합니다. 액세스 JWT는 폐기하지 않습니다.
로그아웃 엔드포인트 연결
src/main/java/org/sopt/hashi/auth/internal/web/AuthController.java, src/main/java/org/sopt/hashi/auth/code/AuthSuccessCode.java
POST /api/v1/auth/logout이 Origin과 리프레시 쿠키를 확인합니다. 로그아웃 후 쿠키를 만료시키고 LOGOUT_SUCCESS를 반환합니다. CSRF 방어 설명도 갱신합니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AuthController
  participant UserAuthService
  participant RefreshTokenSession
  Client->>AuthController: POST /api/v1/auth/logout
  AuthController->>AuthController: Origin 및 리프레시 쿠키 검증
  AuthController->>UserAuthService: 리프레시 토큰 폐기 요청
  UserAuthService->>RefreshTokenSession: 사용자 리프레시 세션 폐기
  AuthController-->>Client: 쿠키 만료 및 LOGOUT_SUCCESS 응답
Loading

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 유저 로그아웃 기능 추가

1 participant