Refactor: JWT 키 생성 및 검증 로직을 이전 방식으로 롤백 #288
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.
📄 Work Description
표준적인 JWT 키 생성 방식 도입을 시도했으나, 이로 인해 기존 사용자들의 토큰이 만료되지 않았음에도 재로그인을 해야 하는 불편함이 발생할 수 있음을 확인했습니다.
사용자 경험을 최우선으로 고려하여, 더 나은 방식(듀얼 키 등)의 도입은 추후 과제로 남겨두고, 우선 안정성이 검증된 과거의 단일 키 방식으로 롤백하는 것을 결정했습니다.
특히, 과거 시스템이
secret-key를 Base64 인코딩하여 사용했던 고유한 로직을 그대로 복원하여 완전한 하위 호환성을 보장하는 데 중점을 두었습니다.1. feat: JWT 시크릿 키 Base64 인코딩 방식 복원
ValueConfig.java:@PostConstruct를 사용하여application.yml에서 읽어온secret-key를 Base64로 인코딩하는 과거 로직을 복원했습니다. 이를 통해 모든 토큰이 일관된 방식으로 서명될 수 있는 기반을 마련했습니다.2. refactor: JwtProvider를 단일 키 처리 방식으로 단순화
JwtProvider.java: New/Old 듀얼 키 관리 로직을 모두 제거하고,ValueConfig에서 처리된 최종 키를 받아 사용하는 단일secretKey필드만 남겼습니다. 토큰 생성(generateToken) 및 검증(parseClaims) 로직이 모두 이 단일 키를 사용하도록 수정하여 코드를 단순화하고 오류 발생 가능성을 줄였습니다.3. refactor: JWT 관련 에러 코드 및 예외 처리 통일
JwtErrorCode.java: 듀얼 키 마이그레이션 시도 과정에서 추가되었으나 현재 사용되지 않는 에러 코드들을 제거하고, 메시지를 명확하게 정리했습니다.AuthService.java,User.java: 정리된JwtErrorCode에 맞춰 예외 처리 부분을INVALID_TOKEN으로 통일하여 일관성을 확보했습니다.💬 To Reviewers
ValueConfig에서 인코딩)과 현재JwtProvider의 초기화 로직이 어떻게 연계되는지 중점적으로 봐주시면 감사하겠습니다.⚙️ ISSUE