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

[feat] 소셜 로그인 API 구현 #15

Merged
merged 11 commits into from
Jan 7, 2024
Merged

[feat] 소셜 로그인 API 구현 #15

merged 11 commits into from
Jan 7, 2024

Conversation

gardening-y
Copy link
Member

Related Issue 📌

close #14

Description ✔️

  • 소셜 로그인 비즈니스 로직인 UserService 클래스를 구현하였습니다.
  • UserController 클래스를 구현하였습니다.
  • UserRepository 클래스를 구현하였습니다.
  • 로그인 요청, 응답 dto로 UserSignInRequest, UserResponse 클래스를 구현하였습니다.
  • RefreshToken을 Redis에서 관리하기 위해 RefreshToken, RefreshTokenRepository 클래스를 구현하였습니다.
  • string platform과 enum platform를 매핑해주는 getEnumPlatformFromStringPlatform 메서드를 구현하였습니다.

Copy link
Member

@SunwoongH SunwoongH left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다!


@RequiredArgsConstructor
@RequestMapping("/api/users")
@RestController
Copy link
Member

Choose a reason for hiding this comment

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

ResponseEntity를 응답으로 반환하는 경우 ResponseBody 어노테이션이 불필요하기 때문에 Controller 어노테이션을 적용해도 좋을 것 같습니다.

Comment on lines +33 to +41
public UserResponse signIn(String token, UserSignInRequest request) {
Platform enumPlatform = getEnumPlatformFromStringPlatform(request.platform());
String platformId = getPlatformId(token, enumPlatform);
User findUser = getUser(enumPlatform, platformId);
Token issueToken = jwtProvider.issueToken(findUser.getId());
updateRefreshToken(issueToken.refreshToken(), findUser);

return UserResponse.of(issueToken);
}
Copy link
Member

Choose a reason for hiding this comment

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

클래스 레벨에 Transactional 어노테이션이 read only 옵션으로 적용되어 있어서 해당 클래스의 모든 public 메서드에서 변경 감지 동작이 이루어지지 않게 됩니다. 따라서 User 엔티티의 refresh token을 update 하는 과정이 정상 수행되지 않을 것 같습니다. 엔티티 데이터의 변경이 필요한 메서드 위에 read only 옵션이 적용되지 않은 Transactional 어노테이션을 추가적으로 적용하여 해결하면 좋을 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

헉.. 오류 발견 감사합니다 :)

@gardening-y gardening-y requested a review from SunwoongH January 7, 2024 09:51
@gardening-y gardening-y merged commit e086dd1 into develop Jan 7, 2024
1 check passed
@SunwoongH SunwoongH deleted the feature/14 branch July 11, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 소셜 로그인 API 구현
2 participants