-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(#45): redis 모듈 추가 #49
Conversation
redisConfig 파일까지 작성되면 Merge 하겠습니다~ |
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 만료 시 refreshToken을 활용해서 accessToken을 재발급하는 로직만 추가하면 완벽할 것 같네요 😁
heachi-core/auth-api/src/main/java/com/heachi/auth/api/service/auth/AuthService.java
Outdated
Show resolved
Hide resolved
heachi-core/auth-api/src/main/java/com/heachi/auth/api/service/auth/AuthService.java
Outdated
Show resolved
Hide resolved
heachi-core/auth-api/src/main/java/com/heachi/auth/api/service/auth/AuthService.java
Show resolved
Hide resolved
heachi-core/auth-api/src/main/java/com/heachi/auth/api/service/auth/AuthService.java
Outdated
Show resolved
Hide resolved
…heachi-domain-redis
- [feat] Entity - [feat] repository - [feat] service
- RTK 저장, 삭제 테스트
- RefreshTokenException 구현
- logout 테스트 - RefreshToken CRUD 테스트
… into feat(#45)-heachi-domain-redis
03a4b2d
to
0ac592c
Compare
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.
점점 실력이 느는 것 같아 아주 뿌듯하군요!
리뷰 남겼습니다. 추가로 기능 구현 되시면, 리뷰 요청해주세요 😁
@@ -72,6 +73,13 @@ public JsonResult<UserSimpleInfoResponse> userInfo(@AuthenticationPrincipal User | |||
return JsonResult.successOf(UserSimpleInfoResponse.of(user)); | |||
} | |||
|
|||
@GetMapping("/logout") | |||
public JsonResult<String> logout(@RequestHeader(name = "Authorization") String token) { | |||
String[] tokens = token.split(" "); |
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.
Arrays.asList(token.split(" " ))으로 List로 받아 사용하는 건 어떨까요?
그후 List의 size 체크 후 인덱스를 접근하는게 OutOfBounds 에러를 방지할 수 있을 것 같습니다.
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.
|
||
// refreshToken 유효성 검사 | ||
if (!jwtService.isTokenValid(refreshToken, email)) { | ||
throw new RefreshTokenException(ExceptionMessage.JWT_INVALID_RTK); |
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 관련 예외인데 RefreshTokenException을 만들어 사용하신 이유가 있을까요??
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.
… into feat(#45)-heachi-domain-redis
재발급 구현 부분 수정 & 테스트 해봤어요 |
늦어서 죄송하빈다..! |
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.
고생하셨습니다~ 필요없는 부분 주석 제거와 추가로 에러, 로직 성공 부분들에 로그를 달아주셨으면 좋겠습니다 ㅎㅎ.
되도록 log.info(">>>> {} : {}")
형식으로 통일시켜주세요~
if (!jwtService.isTokenValid(refreshToken, claims.getSubject())) { | ||
throw new JwtException(ExceptionMessage.JWT_INVALID_RTK); | ||
// 레디스에 존재하는지 확인 | ||
if (refreshTokenRepository.findById(refreshToken).isEmpty()) { |
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.
기존에 모든 Optional이 Null일때 orElseThrow를 썼는데 통일하는게 좋아보입니다. ㅎ.ㅎ
- 성공, 실패 로그 추가 - findById() 예외처리 시 orElseThrow() 사용
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.
확인했습니다! 고생하셨어용
관련 이슈
#45