-
Notifications
You must be signed in to change notification settings - Fork 1
[BE-Feat] 로그아웃 기능 구현 #363
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
[BE-Feat] 로그아웃 기능 구현 #363
Conversation
WalkthroughThis pull request adds logout functionality to the backend authentication flow. A new Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant AC as AuthController
participant AS as AuthService
participant CU as CookieUtil
C->>AC: POST /api/v1/logout
AC->>AS: logout(response)
AS->>CU: deleteRefreshTokenCookie()
CU-->>AS: Cookie object
AS-->>AC: void
AC-->>C: ResponseEntity (No Content)
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
backend/src/main/java/endolphin/backend/global/util/CookieUtil.java (1)
38-45: Well-implemented deleteRefreshTokenCookie methodThe implementation correctly handles cookie deletion by setting its value to null and MaxAge to 0, which instructs browsers to immediately remove the cookie. The method also maintains consistency with the existing cookie creation by reusing the same security properties.
Consider adding JavaDoc to document the purpose and behavior of this method:
+ /** + * Creates a cookie configured to delete the refresh token from the client. + * Sets value to null and MaxAge to 0 to ensure immediate deletion by the browser. + * + * @return Cookie configured to delete the refresh token + */ public Cookie deleteRefreshTokenCookie() { Cookie refreshTokenCookie = new Cookie(properties.name(), null); refreshTokenCookie.setHttpOnly(properties.httpOnly()); refreshTokenCookie.setSecure(properties.secure()); refreshTokenCookie.setPath(properties.path()); refreshTokenCookie.setMaxAge(0); return refreshTokenCookie; }backend/src/main/java/endolphin/backend/domain/auth/AuthService.java (1)
77-80: Logout implementation looks goodThe implementation effectively invalidates the refresh token cookie by adding a cookie with MaxAge=0 to the response.
Consider enhancing the TODO comment with more specific information about the planned implementation:
public void logout(HttpServletResponse response) { response.addCookie(cookieUtil.deleteRefreshTokenCookie()); - //TODO: refresh token 무효 처리 + //TODO: Implement refresh token invalidation as part of Refresh Token Rotation (RTR) - Issue #XXX }backend/src/main/java/endolphin/backend/domain/auth/AuthController.java (1)
7-7: Remove unused importThe
ApiResponsesimport is not being used in the class.-import io.swagger.v3.oas.annotations.responses.ApiResponses;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
backend/src/main/java/endolphin/backend/domain/auth/AuthController.java(2 hunks)backend/src/main/java/endolphin/backend/domain/auth/AuthService.java(3 hunks)backend/src/main/java/endolphin/backend/global/util/CookieUtil.java(1 hunks)
🔇 Additional comments (2)
backend/src/main/java/endolphin/backend/domain/auth/AuthService.java (1)
61-61: Formatting improvementGood spacing improvement for better readability.
backend/src/main/java/endolphin/backend/domain/auth/AuthController.java (1)
73-78: Well-implemented logout endpointThe logout endpoint is appropriately implemented as a POST request with proper documentation and correct response handling. The method returns 204 No Content status which is appropriate for this operation.
kwon204
left a comment
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.
고생하셨습니다
#️⃣ 연관된 이슈>
📝 작업 내용> 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)
🙏 여기는 꼭 봐주세요! > 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
Summary by CodeRabbit