[기본과제/심화과제] 6주차 JWT 토큰 구현#4
Open
hayounSong wants to merge 15 commits intomainfrom
Hidden character warning
The head ref may contain hidden characters: "6\uc8fc\ucc28"
Open
Conversation
2zerozu
approved these changes
Jun 2, 2023
Comment on lines
+27
to
+32
| @Bean | ||
| public RedisTemplate<?, ?> redisTemplate() { | ||
| RedisTemplate<byte[], byte[]> redisTemplate = new RedisTemplate<>(); | ||
| redisTemplate.setConnectionFactory(redisConnectionFactory()); | ||
| return redisTemplate; | ||
| } |
Comment on lines
+7
to
+8
| @Id | ||
| private String refreshToken; |
There was a problem hiding this comment.
memberId가 아니라 refreshToken에 id 어노테이션을 붙여주네요??
| ValueOperations<String,Long> valueOperations= redisTemplate.opsForValue(); | ||
| Long memberId=valueOperations.get(refreshToken); | ||
|
|
||
| if(Objects.isNull(memberId)){ |
There was a problem hiding this comment.
맨날 if(memberId==null) 썼는데 Objects.isNull()로도 사용할 수 있네요!! 배워갑니다
| */ | ||
| NOT_FOUND_USER_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 유저입니다"), | ||
| NOT_FOUND_POST_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 게시물입니다"), | ||
| NOT_FOUND_EMOTION_EXCEPTION(HttpStatus.NOT_FOUND, "존재하지 않는 감정 기록입니다"), |
|
|
||
| import sopt.org.fourthSixSeminar.exception.Error; | ||
|
|
||
| public class BadRequestException extends sopt.org.fourthSeminar.exception.model.SoptException { |
Comment on lines
+6
to
+7
| public BadRequestException(Error error, String message) { | ||
| super(error, message); |
There was a problem hiding this comment.
public BadRequestException(ErrorType error) {
super(error, error.getMessage());
}
이렇게 쓰면 아래 Service단에서 ...더보기
| @Transactional | ||
| public UserResponseDto create(UserRequestDto request) { | ||
| if (userRepository.existsByEmail(request.getEmail())) { | ||
| throw new ConflictException(Error.ALREADY_EXIST_USER_EXCEPTION, Error.ALREADY_EXIST_USER_EXCEPTION.getMessage()); |
There was a problem hiding this comment.
ConflictException(Error.ALREADY_EXIST_USER_EXCEPTION)
개인적으로 이렇게 쓰면 더 가독성있어보이는거같아요!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SERVER PR
JWT 토큰 및 Redis를 이용한 RefreshToken을 살짝 구현해보았습니다.
🐕 과제 구현 명세
🐥 이런 점이 새로웠어요 / 어려웠어요