-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Mod] token 유효성 응답 수정 #163
Conversation
https://github.com/DevKor-github/OnTime-back/pull/162와 다른점은 경우를 |
return; | ||
} | ||
|
||
if (refreshToken != null) { | ||
checkRefreshTokenAndReIssueAccessToken(response, refreshToken); | ||
return; | ||
} |
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문 순서 바꾸면 좋을 것 같아요.
모든 요청에 대해서 헤더에 엑세스토큰만 담는건 확실한데
엑세스토큰 재발급이 필요한 경우에는 리프레시랑 엑세스토큰을 같이 담는 경우도 있을 수 있거든요.
일단 그래도 위 경우는 드문 경우이기 때문에 코드 자체는 이 정도면 좋은 것 같아서 따로 수정하실 필요는 없을 것 같긴합니다.
나중에 제가 만료시간쪽 검토하면서 코드 리팩토링해보겠습니다.
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.
이 부분은 순서를 바꾸는게 더 적합하다는 의견에 동의하는데 지금 제가 바꿔서 반영해도 될까요?
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.
넵 그렇게 해주시면 감사하겠습니다~
@@ -158,7 +158,7 @@ public boolean isTokenValid(String token) { | |||
return true; | |||
} catch (Exception e) { | |||
log.error("유효하지 않은 토큰입니다. {}", e.getMessage()); | |||
throw new InvalidTokenException("유효하지 않은 토큰입니다."); | |||
return false; |
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.
여기 return false 말고 원래처럼 Exception날리되 엑세스 만료와, 리프레시 만료 Exception을 다르게 날리고
try catch구문에서 catch문을 2개 쓰면 조금 더 완결성 있어질 것 같은데
저도 이 아이디어가 실제로 작동할지 확실한 건 아니여서 나중에 제가 만료시간쪽 검토하면서 리팩토링 해보겠습니다.
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 (refreshToken != null) { | ||
checkRefreshTokenAndReIssueAccessToken(response, refreshToken); | ||
if (accessToken != null && jwtTokenProvider.isTokenValid(accessToken)) { | ||
checkAccessTokenAndAuthentication(request, response, filterChain); |
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.
순서 변경해주신거 확인했습니다. 굉장히 수고 많으셨습니다~
응답 형식
accessToken != null && jwtTokenProvider.isTokenValid(accessToken)
refreshToken != null
후,checkRefreshTokenAndReIssueAccessToken
에서 확인