feat: JWT에서 회원 ID 추출 유틸 추가 및 적용#20
Conversation
- Jwt 확장 함수로 memberId 추출 메서드 추가 - subject가 숫자가 아닌 경우 INVALID_TOKEN 예외 처리 로직 구현 - JwtMemberIdTest로 정상/비정상 케이스 테스트 추가 - SchoolEmailVerificationController에 Jwt.memberId() 메서드를 적용하여 중복 로직 제거
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 689ef70ea6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return subject.toLongOrNull() | ||
| ?: throw BusinessException(CommonErrorCode.INVALID_TOKEN) |
There was a problem hiding this comment.
null subject도 INVALID_TOKEN으로 처리하세요
Jwt.subject는 토큰에 sub 클레임이 없으면 null이 될 수 있는데, 현재 구현은 subject.toLongOrNull()을 바로 호출해서 이 경우 NullPointerException이 발생합니다. 그러면 의도한 BusinessException(INVALID_TOKEN)이 아니라 전역 예외 처리에서 500(INTERNAL_ERROR)로 떨어져 잘못된 토큰이 서버 오류처럼 보이게 됩니다. subject?.toLongOrNull()처럼 null-safe 변환 후 실패 시 INVALID_TOKEN을 던지도록 바꿔야 합니다.
Useful? React with 👍 / 👎.
📌 작업 개요
JWT에서 회원 ID 추출 유틸 추가 및 적용
🔗 관련 이슈
✨ 변경 사항
🧪 테스트
✅ 체크리스트
feature/,fix/,hotfix/등)💬 리뷰어에게
@codex