Conversation
WalkthroughThis update introduces a complete user logout feature, including controllers, service logic, repository methods, exception handling, and integration tests. It also adds a health check endpoint and ensures public access to its route. The logout flow invalidates refresh tokens, handles expired tokens, and provides appropriate success or error responses. Related constants and enums are updated accordingly. Changes
Sequence Diagram(s)User Logout FlowsequenceDiagram
participant Client
participant LogOutController
participant LogOutUsecaseImpl
participant JwtResolver
participant UserFinder
participant TokenRefreshService
participant JwtTokenRepository
Client->>LogOutController: POST /api/v1/auth/log-out (Authorization: Bearer token)
LogOutController->>LogOutUsecaseImpl: execute(accessToken)
LogOutUsecaseImpl->>JwtResolver: getUserIdFromJwtToken(accessToken)
JwtResolver-->>LogOutUsecaseImpl: userPublicId or throw UserJwtException
LogOutUsecaseImpl->>UserFinder: findUserByPublicId(userPublicId)
UserFinder-->>LogOutUsecaseImpl: User or throw UserException
LogOutUsecaseImpl->>TokenRefreshService: getStoredRefreshToken(userId)
TokenRefreshService-->>LogOutUsecaseImpl: refreshToken or throw UserJwtException
LogOutUsecaseImpl->>TokenRefreshService: removeRefreshToken(userId)
TokenRefreshService->>JwtTokenRepository: deleteRefreshTokenByUserId(userId)
JwtTokenRepository-->>TokenRefreshService: (void)
TokenRefreshService-->>LogOutUsecaseImpl: (void)
LogOutUsecaseImpl-->>LogOutController: true/false
LogOutController-->>Client: 200 OK (logout success or already logged out)
Health Check EndpointsequenceDiagram
participant Client
participant HealthCheckController
Client->>HealthCheckController: GET /checker/health-check
HealthCheckController-->>Client: 200 OK (SuccessResponse)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (5)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. 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 (
|
src/main/java/org/runimo/runimo/user/controller/LogOutController.java
Outdated
Show resolved
Hide resolved
src/test/java/org/runimo/runimo/user/controller/LogOutControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/runimo/runimo/user/controller/LogOutControllerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/runimo/runimo/checker/controller/HealthCheckControllerTest.java
Outdated
Show resolved
Hide resolved
|
고생하셨어요! 몇가지 리뷰 남겼습니다 😄 |
|
꼼꼼하게 봐주셔서 감사합니다! |
src/main/java/org/runimo/runimo/auth/service/logout/LogOutUsecaseImpl.java
Outdated
Show resolved
Hide resolved
ekgns33
left a comment
There was a problem hiding this comment.
고생하셨습니다!! getPublicId 위치 조정에 대해서만 하나 봐주세용 👍
|
토큰 로직 수정되었습니다. |
|
로그아웃 성공 응답을 두가지로 분리했습니다.
또한 아래 통합 테스트 케이스들 추가했습니다!
감사합니다. 또 놓친 부분 있다면 말씀주시고 없으시면 머지할게요 |
[작업 사항]
[추가 작업 사항]
로그아웃 성공 응답을 두가지로 분리했습니다.
또한 아래 통합 테스트 케이스들 추가했습니다!
[comment]
로그아웃은 현재 내부적으로 하는 일이 refersh token 삭제 뿐이나,
이후 로그아웃 후처리에서 추가적인 로직이 들어갈 수도 있을거라 생각해서 usecase 정의했습니다.
또한 log out 네이밍 시
띄어쓰기를 넣느냐 안넣느냐에 대해 혼란스러울 수 있을 것 같아
모두 띄어쓰기 하는 걸로 작업했습니다.
Summary by CodeRabbit