[FIX] 만료된 토큰으로 애플 소셜 연동 불가 이슈 해결 #444
Merged
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.
Related Issue
Key Changes
1. 문제 현상 (AS-IS)
PATCH /auth/apple/sync) 시 Access Token이 만료된 상태라면 Security Filter Chain에서401 Unauthorized가 발생2. 해결 방안 (TO-BE)
만료된 토큰이라도 사용자 식별(User ID) 만 가능하다면 연동 로직을 수행할 수 있도록 변경했습니다.
SecurityConfig.java:/auth/apple/sync경로를permitAll()로 설정하여 Security Filter의 토큰 만료 검증을 우회하도록 수정JwtProvider.java:getUserIdFromExpiredToken()메서드 추가Jwts.parserBuilder()실행 시ExpiredJwtException이 발생하더라도, 예외 객체 내의Claims를 조회하여userId를 추출하도록 구현AuthController.java:@AuthenticationPrincipal은 유효한 토큰일 때만 동작하므로 제거@RequestHeader("Authorization")을 통해 토큰 문자열을 직접 받아, 위에서 구현한 파싱 메서드로 유저를 식별하도록 변경To Reviewers
References