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

수정 : 로그인 인증 예외 핸들러 적용 및 JWT 예외 반환 로직 수정 #112

Merged
merged 5 commits into from
Oct 9, 2023

Conversation

2jie0516
Copy link
Collaborator

@2jie0516 2jie0516 commented Oct 8, 2023

🔍 어떤 PR인가요?

  • 로그인 실패 시 기존 500 예외를 반환했던 문제에 대해 예외 핸들러를 수정하여서 정상적으로 예외를 반환하도록 하였습니다.
  • JWT 검증 실패 시에 500 예외를 반환했던 문제에 대해 예외 반환 로직을 수정하여서 정상적으로 예외를 반환하도록 하였습니다.

😋 To Reviewer

  • JWT 예외 같은 경우 필터에서 예외가 발생되기 때문에 @RestControllerAdvice의 범위 밖이라는 것을 알게되었습니다.
  • 따라서 예외 핸들러가 아닌 필터 내에서 직접 응답을 반환하도록 하였습니다 !
    image

Copy link
Collaborator

@Hejow Hejow 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 77 to 78
public void validateToken(String token) {
Jwts.parserBuilder().setSigningKey(key).build().parseClaimsJws(token);
Copy link
Collaborator

Choose a reason for hiding this comment

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

코드가 이렇게 수정되면 더 이상 validateToken 네이밍은 아닐 것 같은데 어떻게 생각하시나용!??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

140ef5f 피드백 반영

  • 파싱 메소드 자체가 좀 중복되어어서 로직을 변경하였습니다.
  • 해당 메소드는 삭제하였고 parseClaims 메소드에서 일괄적으로 수행합니다 !

@ResponseStatus(UNPROCESSABLE_ENTITY)
public ErrorResponse handleUnexpectedException(BadCredentialsException e) {
log.warn("BadCredentialException Occurs : {}", e.getMessage());
public ErrorResponse handleUnexpectedException(AuthenticationException e) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

메서드 이름이 이상한 것 같아요!~!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

0aff2bd 커밋 피드백 반영

  • 앗 메소드 네이밍 수정하였습니다 ㅎㅎ

@2jie0516 2jie0516 merged commit 8f9a5f1 into main Oct 9, 2023
1 check passed
@2jie0516 2jie0516 deleted the sehan-refactor branch October 9, 2023 05:26
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.

2 participants