Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refresh token을 도입한다 #818

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

feat: refresh token을 도입한다 #818

wants to merge 7 commits into from

Conversation

drunkenhw
Copy link
Collaborator

@drunkenhw drunkenhw commented Sep 29, 2023

📄 Summary

refresh token을 추가했습니다. 로직은 다음과 같습니다.

  1. 사용자가 로그인을 하면 access token은 body로 refresh token은 cookie로 넘겨줍니다.
  2. 사용자의 access token이 만료된다면 403 에러를 반환합니다
  3. 이때 403 에러가 발생하면 front에서 refresh token으로 access token을 재발급 받기위해 다른 엔드포인트로 접근합니다.
  4. 그리고 access token을 재발급 받습니다.
  5. 만약 로그아웃을 한다면 db에 저장되어 있는 refresh token을 삭제합니다.

🕰️ Actual Time of Completion

3시간

🙋🏻 More

close #815

@drunkenhw drunkenhw temporarily deployed to test September 29, 2023 04:56 — with GitHub Actions Inactive
Copy link
Collaborator

@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.

추석인데 고생하셨습니다! 역시 깔끔하네요
맛있는 거 드시고 쉬엄쉬엄 하세요 즐거운 연휴 보내세요 👍

.httpOnly(true)
.build();
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

개행 삭제해주세요

@@ -77,9 +93,50 @@ public class AuthControllerTest extends MockBeanInjection {
),
responseFields(
fieldWithPath("token").description("Access token")
),
responseHeaders( //응답 헤더 문서화
Copy link
Collaborator

Choose a reason for hiding this comment

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

주석은 없애주세요~

import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.servlet.Filter;

@Profile("!test")
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분이 잘 이해가 안가는데요 Profile을 이와 같이 설정한 이유가 무엇인가요??

@drunkenhw drunkenhw added 🌱 기능추가 새로운 기능 요청입니다 BE 백엔드 관련 이슈입니다 labels Oct 8, 2023
@drunkenhw drunkenhw self-assigned this Oct 8, 2023
return ResponseCookie.from(REFRESH_TOKEN, refreshToken)
.maxAge(Duration.ofMillis(expireLength))
.path(VALID_COOKIE_PATH)
.sameSite("None")
Copy link
Collaborator

Choose a reason for hiding this comment

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

sameSite None 아주 좋네요 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

어우 정말 오랜만이네요 반가워요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 관련 이슈입니다 🌱 기능추가 새로운 기능 요청입니다
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refresh token을 도입한다
3 participants