Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

[BE] refactor: logout 및 reissueRefreshToken 요청시 리프래시 토큰이 없는 경우 추가 핸들링 #571

Merged
merged 2 commits into from
Oct 9, 2023

Conversation

HubCreator
Copy link
Member

🛠️ Issue

✅ Tasks

  • 로그아웃 시 ArgumentResolver가 동작하지 않도록 수정
  • 로그아웃 시 refreshToken이 없는 케이스 핸들링
  • refreshTokn 재발급 요청시 refreshToken이 없는 케이스 핸들링

⏰ Time Difference

  • 1 -> 1

📝 Note

@HubCreator HubCreator added 🐞 bug 버그, 에러 해결 🧪 test 테스트 코드 🛠️ refactor 코드 리팩터링, 개선 🕋 backend 백엔드 작업 labels Oct 8, 2023
@HubCreator HubCreator added this to the 최종 데모데이 milestone Oct 8, 2023
@HubCreator HubCreator self-assigned this Oct 8, 2023
@HubCreator HubCreator changed the title refactor: logout 및 reissueRefreshToken 요청시 리프래시 토큰이 없는 경우 추가 핸들링 [BE] refactor: logout 및 reissueRefreshToken 요청시 리프래시 토큰이 없는 경우 추가 핸들링 Oct 8, 2023
Copy link
Collaborator

@ezzanzzan ezzanzzan left a comment

Choose a reason for hiding this comment

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

refresh에서 탈출합시다..

@@ -25,7 +25,7 @@ public void addInterceptors(final InterceptorRegistry registry) {

registry.addInterceptor(new AuthInterceptor(jwtTokenProvider))
.addPathPatterns("/member/**", "/writings/**", "/categories/**", "/trash/**", "/connections/**", "/auth/**")
.excludePathPatterns("/connections/**/redirect", "/auth/login/**", "/auth/token/refresh")
.excludePathPatterns("/connections/**/redirect", "/auth/login/**", "/auth/token/refresh", "/auth/logout")
Copy link
Collaborator

Choose a reason for hiding this comment

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

이제 확인했는데 여기 /connections/**/redirect면 tistory랑 notion도 해당될 거 같은데 이렇게 의도된게 맞나요 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

redirect할 때에 경로들인 것으로 확인했습니다. 해당 인터셉터는 AuthInterceptor로, AccessToken(JWT)를 확인하는 인터셉터이므로 빠진 제외시킨 것 같고, 문제 없을 것 같습니다!

Copy link
Collaborator

@ingpyo ingpyo 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 +82 to 89
@Test
@DisplayName("쿠키에 리프레시 토큰이 없더라도, 로그아웃시 정상적으로 200 상태를 반환한다.")
void logout_without_refreshToken() throws Exception {
mockMvc.perform(
post("/auth/logout").contentType(MediaType.APPLICATION_JSON)

)
.andExpect(status().isOk());
Copy link
Collaborator

Choose a reason for hiding this comment

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

멋진데요?👍

Comment on lines 74 to 76
if (Objects.isNull(refreshToken)) {
throw new ExpiredRefreshTokenException();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

검증로직은 메서드로 빼면 깔끔할거같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

넵!!

@HubCreator HubCreator merged commit ea9533f into develop Oct 9, 2023
@HubCreator HubCreator deleted the refactor/logout-and-reissue-refresh-562 branch October 9, 2023 12:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕋 backend 백엔드 작업 🐞 bug 버그, 에러 해결 🛠️ refactor 코드 리팩터링, 개선 🧪 test 테스트 코드
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

로그아웃 및 리프래시 토큰 쿠키 추출 수정
3 participants