Skip to content

Conversation

@7ijin01
Copy link
Member

@7ijin01 7ijin01 commented Sep 15, 2025

📌 PR 개요

  • 커스텀로그아웃 필터 기반 로그아웃 구현
  • access, refresh 쿠키 제거

✅ 변경사항


🔍 체크리스트

  • PR 제목은 명확한가요?
  • 관련 이슈가 있다면 연결했나요?
  • 로컬 테스트는 통과했나요?
  • 코드에 불필요한 부분은 없나요?

📎 관련 이슈

Closes #85


💬 기타 참고사항

Summary by CodeRabbit

  • 신기능
    • 로그아웃 API 추가: POST 요청으로 로그아웃 처리 지원.
    • 유효한 리프레시 토큰 확인 후, 액세스/리프레시 쿠키를 즉시 만료시켜 안전하게 세션 종료.
    • 성공 시 200 OK 응답.
  • 문서
    • Swagger/OpenAPI 주석으로 로그아웃 API 문서화(요약, 태그, 응답 코드 포함).
  • 기타(Chores)
    • CI 워크플로우가 특정 기능 브랜치에서만 실행되도록 트리거 분기 변경.

@7ijin01 7ijin01 linked an issue Sep 15, 2025 that may be closed by this pull request
1 task
@coderabbitai
Copy link

coderabbitai bot commented Sep 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

로그아웃 기능 추가를 중심으로 보안 필터 체인에 CustomLogoutFilter가 도입되었고, JWT에서 category 클레임 조회 메서드가 추가되었습니다. 로그아웃 API 문서용 인터페이스와 컨트롤러가 새로 생성되었습니다. 릴리스 워크플로우는 트리거 브랜치가 변경되었습니다.

Changes

Cohort / File(s) Summary
CI Workflow Trigger
.github/workflows/release.yml
워크플로우 트리거 브랜치를 main에서 feat/#85-logout로 변경.
API Docs (Logout)
src/main/java/com/opendata/docs/LogoutControllerDocs.java
LogoutControllerDocs 인터페이스 추가: doLogout() 문서화(@Tag/@Operation/@ApiResponses).
Logout Controller
src/main/java/com/opendata/domain/user/controller/LogoutController.java
LogoutController 추가, @PostMapping("/logout")doLogout() 노출. 선언은 ResponseEntity<String> 반환이나 구현은 ResponseEntity.ok().build() 반환.
Security Configuration
src/main/java/com/opendata/global/config/SecurityConfig.java
CustomLogoutFilterLogoutFilter 이전에 등록. 기존 JwtFilter 등록 포맷 정리(기능 동일).
Custom Logout Filter
src/main/java/com/opendata/global/jwt/CustomLogoutFilter.java
POST /logout/api/logout 요청을 가로채 처리. 쿠키에서 리프레시 토큰 조회/검증(만료, category=="refresh"). 유효 시 액세스/리프레시 쿠키 제거 후 200 응답. 그 외 400 응답 또는 체인 진행.
JWT Utility Update
src/main/java/com/opendata/global/jwt/JwtUtil.java
getCategory(String token) 메서드 추가로 토큰의 category 클레임 제공.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor U as User
    participant F as Security Filter Chain
    participant CLF as CustomLogoutFilter
    participant JU as JwtUtil
    participant C as LogoutController

    Note over U,F: POST /logout (또는 /api/logout)

    U->>F: HTTP 요청
    F->>CLF: 필터 전처리
    alt 경로 매칭(POST /logout|/api/logout)
        CLF->>CLF: 쿠키에서 refresh 추출
        CLF->>JU: isExpired(refresh)?
        alt 만료/예외/없음/category!=refresh
            CLF-->>U: 400 Bad Request
            Note over CLF,U: 유효하지 않은 토큰
        else 유효
            CLF->>U: Set-Cookie: access, refresh 삭제(Max-Age=0)
            CLF-->>U: 200 OK
            Note over CLF,U: 체인 중단, 컨트롤러 미도달
        end
    else 비매칭 요청
        CLF->>F: 다음 필터로 위임
        F->>C: (매칭 시) Controller 호출
        C-->>U: 200 OK (본문 없음)
        Note over C,U: 선언은 String, 구현은 body 없음
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • [docs] swagger 설정 #44: Swagger 의존성 및 문서 인터페이스 추가 작업으로, 본 PR의 LogoutControllerDocs 도입과 문서 구조가 연계됨.

Poem

토큰 바람 휙—쿠키는 사라져요 🍪
로그아웃 길목엔 필터가 먼저 서고,
토끼는 깡총 뛰며 보안문을 지켜요.
"refresh냐?" 속삭여 확인하고,
깔끔히 굿바이, 200으로 인사해요.
오늘도 안전하게, 점프 점프! 🐇

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#85-logout

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b9c8d3 and 8217e54.

📒 Files selected for processing (6)
  • .github/workflows/release.yml (1 hunks)
  • src/main/java/com/opendata/docs/LogoutControllerDocs.java (1 hunks)
  • src/main/java/com/opendata/domain/user/controller/LogoutController.java (1 hunks)
  • src/main/java/com/opendata/global/config/SecurityConfig.java (3 hunks)
  • src/main/java/com/opendata/global/jwt/CustomLogoutFilter.java (1 hunks)
  • src/main/java/com/opendata/global/jwt/JwtUtil.java (1 hunks)

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@7ijin01 7ijin01 merged commit c192a8a into main Sep 15, 2025
3 of 4 checks passed
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.

[feat] 로그아웃 구현

2 participants