-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 로그아웃 구현 #16
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
Merged
feat: 로그아웃 구현 #16
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5996ff0
feat: 액세스 토큰을 블랙리스트에 등록하는 로직 추가
JoonKyoLee c956bb1
feat: 액세스 토큰 무효화 및 리프레시 토큰 삭제 로직 추가
JoonKyoLee b7d5938
feat: 로그아웃 응답 DTO 추가
JoonKyoLee 66832dd
feat: 로그아웃 서비스 로직 추가
JoonKyoLee 8622658
test: RedisService의 블랙리스트 및 토큰 삭제 테스트 추가
JoonKyoLee 26123c9
test: 리프레시 토큰 블랙리스트 등록 및 토큰 폐기 로직 테스트 추가
JoonKyoLee 5d141a4
test: 로그아웃 서비스 로직 테스트 추가
JoonKyoLee 76eef0e
feat: 로그아웃 API 추가
JoonKyoLee 5961379
test: 로그아웃 API 성공 및 실패 테스트 추가
JoonKyoLee f28ee5b
fix: 로그아웃 인증 허용 규칙 수정
JoonKyoLee 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
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: 5 additions & 0 deletions
5
src/main/java/com/almang/inventory/user/auth/dto/response/LogoutResponse.java
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,5 @@ | ||
| package com.almang.inventory.user.auth.dto.response; | ||
|
|
||
| public record LogoutResponse( | ||
| boolean success | ||
| ) {} |
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.
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.
🧩 Analysis chain
토큰 폐기 로직이 전반적으로 잘 구현되었습니다.
다만, 액세스 토큰을 추출할 수 없는 경우(Line 86에서
accessToken이 null인 경우)에도 리프레시 토큰은 삭제됩니다. 이는 다음 시나리오를 고려해야 합니다:잠재적 문제:
개선 방안:
현재 AuthController의 로그아웃 엔드포인트가 인증이 필요한지 확인이 필요합니다.
다음 스크립트로 로그아웃 엔드포인트의 인증 요구 사항을 확인하세요:
🏁 Script executed:
Length of output: 4190
보안 설정 모순으로 인한 토큰 폐기 로직 실패 위험
검증 결과,
AuthController의 logout 엔드포인트는@AuthenticationPrincipal로 인증을 요구하려 하지만,SecurityConfig의.anyRequest().permitAll()(43줄)이 이를 무효화합니다. 결과적으로 인증되지 않은 사용자가 logout을 호출하면userPrincipal이 null이 되어 88줄에서 NullPointerException 발생하고, 더 심각하게는 해당 사용자의 토큰이 전혀 폐기되지 않습니다.즉시 조치 필요:
SecurityConfig.java의.anyRequest().permitAll()→.requestMatchers("/logout").authenticated()로 변경하여 logout 엔드포인트를 인증 필수로 강제 (또는 Spring Security의 인증 필터가 401을 반환하도록 설정)BadCredentialsException발생시켜 실패 처리참고: 현재 SecurityConfig의 주석 "추후 변경 예정"과 함께 이 보안 설정은 개발/테스트 환경 전용입니다. 프로덕션 배포 전에 필수로 수정하세요.
🤖 Prompt for AI Agents