Skip to content
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

Merged
merged 9 commits into from
Jul 9, 2023
Merged

#21 [feat] jwt 토큰 처리 로직 작성 #25

merged 9 commits into from
Jul 9, 2023

Conversation

sohyundoh
Copy link
Member

✒️ 관련 이슈번호

Key Changes 🔑

  1. jwt 토큰 처리 로직 작성

To Reviewers 📢

  • 중간에 git conflict 발생했는데 관련해서 사라진 내용있으면 알려주세🥲
  • 코드 수정 사항 있으면 알려주세요!

@sohyundoh sohyundoh requested a review from KWY0218 July 9, 2023 12:35
@sohyundoh sohyundoh self-assigned this Jul 9, 2023
Copy link
Member

@KWY0218 KWY0218 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작업하시느라 고생했습니다 ~ !
코맨트 확인해주세요~!

Comment on lines 29 to 38
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()));
}
Copy link
Member

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 과 같은 에러를 던져주면 좋을 것 같습니다.

Copy link
Member

@KWY0218 KWY0218 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋습니다 ~ 👍
머지되고 jwt 관련해서 application 야믈 파일에 추가해야 되는 거 알려주세요~!

@sohyundoh sohyundoh merged commit 3219ba3 into develop Jul 9, 2023
1 check passed
@sohyundoh sohyundoh deleted the feat/#21 branch July 9, 2023 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] JWT Service 구현하기
2 participants