-
Notifications
You must be signed in to change notification settings - Fork 2
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
#21 [feat] jwt 토큰 처리 로직 작성 #25
Conversation
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.
작업하시느라 고생했습니다 ~ !
코맨트 확인해주세요~!
if (!jwtService.verifyToken(token)) { | ||
throw new RuntimeException(String.format("USER_ID를 가져오지 못했습니다. (%s - %s)", parameter.getClass(), parameter.getMethod())); | ||
} | ||
|
||
final String tokenContents = jwtService.getJwtContents(token); | ||
try { | ||
return Long.parseLong(tokenContents); | ||
} catch (NumberFormatException e) { | ||
throw new RuntimeException(String.format("USER_ID를 가져오지 못했습니다. (%s - %s)", parameter.getClass(), parameter.getMethod())); | ||
} |
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.
p2:
해당 에러 메시지는 클라이언트에게 가는 메시지인데, 클라이언트가 parameter의 class 명, parameter의 메서드 명을 알아야 하는지 의문이 드네요..!
또한 RuntimeException으로 던지면 controllerAdivce에서 Exception으로 수집되어 500으로 클라이언트에게 반환이 될 것 같다는 생각이 듭니다..!
따라서 Error 코드를 따로 만들어서 저희가 정의한 NotFoundException 과 같은 에러를 던져주면 좋을 것 같습니다.
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.
좋습니다 ~ 👍
머지되고 jwt 관련해서 application 야믈 파일에 추가해야 되는 거 알려주세요~!
✒️ 관련 이슈번호
Key Changes 🔑
To Reviewers 📢