Skip to content

Conversation

@gustj3104
Copy link
Contributor

@gustj3104 gustj3104 commented Nov 29, 2025

📄 작업 내용

인증 플로우

  • /auth/login : OAuth2 성공 시 refreshToken을 쿠키로 설정하고 /auth/callback으로 리다이렉트

  • 콜백 후 /auth/reissue 호출 시 쿠키에 담긴 refreshToken으로 accessToken을 재발급하고, accessToken만 body로 반환

  • accessToken 만료 시 /auth/reissue로 재발급

  • /auth/logout 호출 시 refreshToken 쿠키를 즉시 만료시킴

  • RefreshTokenCookieSupporter로 쿠키 발급, 삭제 로직 분리

  • 테스트코드 작성

    • AuthControllerReissueTest : /auth/reissue가 refreshToken 쿠키를 받아 accToken만 body에 반환하는지 검증
    • RefreshTokenCookieSupporterTest: addRefreshTokenCookie 호출 시 Set-Cookie 헤더에 refreshToken이 포함되는지 검증
    • AuthServiceTest: refreshToken의 유효성 검증, 토큰으로 조회되는 사용자 검사, 새 TokenResponse 발급 검증

close #10

@gustj3104 gustj3104 requested a review from sosow0212 November 29, 2025 16:08
@gustj3104 gustj3104 self-assigned this Nov 29, 2025
@gustj3104 gustj3104 added the feat 기능 추가 label Nov 29, 2025
@gustj3104 gustj3104 linked an issue Nov 29, 2025 that may be closed by this pull request
Copy link
Contributor

@sosow0212 sosow0212 left a comment

Choose a reason for hiding this comment

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

테스트 한글 외에 큰 이견 없습니다 해당 부분은 적용이 필요하다고 생각하면 바꿔주세요!
테스트 익숙하지 않으셨을텐데 잘 작성해주셨네요 고생 많으셨습니다👍

Comment on lines +86 to +87
fun logout(response: HttpServletResponse) {
refreshTokenCookieSupporter.expireRefreshTokenCookie(response)
Copy link
Contributor

Choose a reason for hiding this comment

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

HttpServletResponse에 값을 심어주는 건 Controller에서 하는게 좋지 않을까요?

Comment on lines 30 to 31
// /auth/reissue 엔드포인트가 쿠키를 받아 TokenResponse, 헤더를 정상 반환하는지 검증
fun reissue_returns_tokenResponse_and_sets_cookie_header(){
Copy link
Contributor

Choose a reason for hiding this comment

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

fun 쿠키를_받아_response에_정상적으로_반환한다 이렇게 한글로 테스트명 표기해도 괜찮을 거 같아요~

한글 시작점과 끝점 사이에 백틱 '`' 사용하시면 돼요


@WebMvcTest(AuthController::class)
@AutoConfigureMockMvc(addFilters = false)
class AuthControllerReissueTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

단위 테스트 좋습니다~ 실제 작동을 테스트하는 E2E 테스트는 조금 익숙해지면 해도 좋을 것 같아요

@gustj3104 gustj3104 merged commit cc7f6bd into develop Dec 9, 2025
1 check passed
@gustj3104 gustj3104 deleted the feat/10 branch December 15, 2025 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

로그인 검증, 로그아웃 구현

3 participants