Skip to content

Conversation

@Gyuhyeok99
Copy link
Contributor

관련 이슈

작업 내용

리프레시 토큰 만료시 쿠키 삭제를 삭제하는 로직을 추가하였습니다.

image

set-cookie에서 잘 삭제된 것을 확인할 수 있습니다.

특이 사항

리뷰 요구사항 (선택)

  1. 기존에 controller 삭제 관련 로직이 없었습니다. 이를 어떻게 하는 게 좋을까요? 예를들어 로그아웃 시에도 리프레시 토큰을 삭제하는 로직이 있는데 이에 대해 검증하는 것이 없습니다. 그래서 이를 mock을 활용해서 테스트를 하는 게 좋을지 고민이 되네요..

  2. 쿠키제거시에 HttpServletResponse를 활용해야하기에 service로직에서 이를 처리하는 건 조금 어긋난다고 생각하여 우선 controller 계층에서 try-catch를 활용해서 해결했습니다. 클로드 피셜 이 방식이 제일 나을 거 같다고 하긴 하는데..(이유는 reissue api에서만 리프레시 토큰을 검증하기 때문에) 이를 그냥 CustomExceptionHandler에서 처리하는 게 좋을지.. 아니면 AuthController 내에서 @ExceptionHandler를 사용하는 게 나을지 고민되긴 하네요

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

Walkthrough

이번 변경사항은 인증 토큰 갱신 시 만료된 리프레시 토큰 처리를 개선하는 작업입니다. AuthController에서 응답 객체를 받도록 메서드 시그니처를 변경하고, 예외 처리 로직을 추가하여 토큰 만료 시 쿠키를 삭제합니다. 동시에 CustomException에 ErrorCode 필드를 추가하여 예외의 타입을 더 명확하게 추적할 수 있도록 구조화했습니다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • wibaek
  • whqtker
  • lsy1307

주요 변경사항 상세

1. AuthController 메서드 개선

  • HttpServletResponse 파라미터 추가로 응답 제어 가능
  • authService.reissue() 호출을 try-catch로 감싸서 CustomException 처리
  • 리프레시 토큰 만료 시 쿠키 삭제 로직 추가 후 예외 재발생
  • 기존의 성공 케이스 흐름은 유지

2. CustomException 예외 클래스 강화

  • 새로운 필드 추가: 에러 코드를 저장하는 ErrorCode 타입
  • 모든 생성자에서 errorCode 필드 할당 처리
  • Lombok 게터를 통해 에러 코드에 접근 가능하도록 개선
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 PR의 핵심 변경사항(리프레시 토큰 만료시 쿠키 삭제)을 명확하고 간결하게 요약하고 있습니다.
Description check ✅ Passed PR 설명은 관련 이슈, 작업 내용, 리뷰 요구사항을 포함하며 이미지와 함께 변경사항을 잘 설명하고 있습니다.
Linked Issues check ✅ Passed AuthController와 CustomException 변경사항이 이슈 #627의 요구사항(리프레시 토큰 만료시 쿠키 제거)을 충족합니다.
Out of Scope Changes check ✅ Passed CustomException에 errorCode 필드 추가는 쿠키 삭제 기능과 직접적으로 연관된 변경사항입니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 리프레쉬 토큰 만료시 쿠키 제거

1 participant