-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 검증 로직 수정 및 로그아웃 구현 #11
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
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
24f6a4c
feat: 검증 및 재발급 구현
gustj3104 f2c82c7
feat: 재발급 테스트코드 추가
gustj3104 ea5153d
feat: 로그아웃 로직 구현
gustj3104 c362135
fix: 테스트코드의 dto 내용 수정
gustj3104 16123fc
fix: application.yml에 콜백 uri 추가
gustj3104 52d1789
feat: 테스트용 더미키 설정
gustj3104 6efc70c
Merge branch 'develop' of https://github.com/DOKI-SERVICE/DOKI_BE int…
gustj3104 bc51cb7
fix: yml 파일 통합
gustj3104 bbbb6c4
Merge branch 'develop' of https://github.com/DOKI-SERVICE/DOKI_BE int…
gustj3104 d1fd752
fix: 테스트 한글명으로 변경
gustj3104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...y/core/auth/dto/response/TokenResponse.kt → ...cture/dto/response/AccessTokenResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,8 @@ | ||
| package com.study.core.auth.dto.response | ||
| package com.study.core.auth.infrastructure.dto.response | ||
|
|
||
| data class TokenResponse( | ||
| data class AccessTokenResponse( | ||
| val grantType: String, | ||
| val accessToken: String, | ||
| val refreshToken: String, | ||
| val accessTokenExpiresIn: Long | ||
| ) { | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/study/core/auth/infrastructure/dto/response/TokenResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package com.study.core.auth.infrastructure.dto.response | ||
|
|
||
| data class TokenResponse( | ||
| val grantType: String, | ||
| val accessToken: String, | ||
| val accessTokenExpiresIn: Long, | ||
| val refreshToken: String, | ||
| val refreshTokenExpiresIn: Long | ||
| ) { | ||
| } |
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/com/study/core/auth/infrastructure/support/RefreshTokenCookieSupporter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package com.study.core.auth.infrastructure.support | ||
|
|
||
| import com.study.core.auth.infrastructure.dto.response.TokenResponse | ||
| import jakarta.servlet.http.HttpServletResponse | ||
| import org.springframework.http.HttpHeaders | ||
| import org.springframework.http.ResponseCookie | ||
| import org.springframework.stereotype.Component | ||
|
|
||
| @Component | ||
| class RefreshTokenCookieSupporter { | ||
|
|
||
| fun addRefreshTokenCookie( | ||
| response: HttpServletResponse, | ||
| refreshToken: String | ||
| ) { | ||
| // refreshToken은 HttpOnly + Secure cookie로 전송 | ||
| val refreshCookie = ResponseCookie.from("refreshToken", refreshToken) | ||
| .httpOnly(true) | ||
| .secure(true) | ||
| .path("/") | ||
| .sameSite("Strict") | ||
| .maxAge(60L * 60 * 24 * 14) // 14일 | ||
| .build() | ||
| response.addHeader(HttpHeaders.SET_COOKIE, refreshCookie.toString()) | ||
| } | ||
|
|
||
| fun expireRefreshTokenCookie(response: HttpServletResponse) { | ||
| val expiredCookie = ResponseCookie.from("refreshToken", "") | ||
| .httpOnly(true) | ||
| .secure(true) | ||
| .path("/") | ||
| .sameSite("Strict") | ||
| .maxAge(0) | ||
| .build() | ||
| response.addHeader(HttpHeaders.SET_COOKIE, expiredCookie.toString()) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HttpServletResponse에 값을 심어주는 건 Controller에서 하는게 좋지 않을까요?