-
Notifications
You must be signed in to change notification settings - Fork 0
[RELEASE] V2.1.7 동일 이메일의 경우 로그인 통합 구현 #340
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,10 @@ public class CustomUserDetailsService implements UserDetailsService { | |
|
|
||
| private final UserRepository userRepository; | ||
|
|
||
| // OrderByIdAsc로 해줌으로써 처음 생성된 계정으로 연결된다. | ||
| @Override | ||
| public UserDetails loadUserByUsername(String username) { | ||
| User user = userRepository.findByEmail(username) | ||
| User user = userRepository.findFirstByEmailOrderByIdAsc(username) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change to return the first user found by email ( |
||
| .orElseThrow(() -> new BaseException(BaseResponseStatus.NOT_FOUND_USER)); | ||
| return new CustomUserDetails(user); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,8 @@ public class OAuthService { | |
|
|
||
| public Tokens kakaoLogin(KakaoLoginRequest request) { | ||
| User user = userRepository.findByProviderId(request.providerId()) | ||
| .orElseGet(() -> userService.join(request.email(), KAKAO, request.providerId())); | ||
| .orElseGet(() -> userRepository.findFirstByEmailOrderByIdAsc(request.email()) | ||
| .orElseGet(() -> userService.join(request.email(), KAKAO, request.providerId()))); | ||
|
Comment on lines
+37
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| return generateOauthJwtTokens(user.getEmail(), KAKAO, request.providerId()); | ||
| } | ||
|
|
@@ -44,11 +45,11 @@ public Tokens kakaoLogin(KakaoLoginRequest request) { | |
| */ | ||
| public Tokens kakaoLoginV2(KakaoLoginRequestV2 request) { | ||
| User user = userRepository.findByProviderId(request.providerId()) | ||
| .orElseGet(() -> userService.joinV2(request.email(), KAKAO, request.providerId(),request.deviceType())); | ||
| .orElseGet(() -> userRepository.findFirstByEmailOrderByIdAsc(request.email()) | ||
| .orElseGet(() -> userService.joinV2(request.email(), KAKAO, request.providerId(),request.deviceType()))); | ||
|
Comment on lines
47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| user.updateDeviceType(request.deviceType()); | ||
|
|
||
| if (user.getDeviceType() == null) { | ||
| user.updateDeviceType(request.deviceType()); | ||
| } | ||
|
|
||
| return generateOauthJwtTokens(user.getEmail(), KAKAO, request.providerId()); | ||
| } | ||
|
|
@@ -58,7 +59,8 @@ public Tokens appleLogin(AppleLoginRequest request) { | |
| OAuthInfo oAuthInfo = appleAuthenticator.getOAuthInfoByIdentityToken(request.identityToken()); | ||
|
|
||
| User user = userRepository.findByProviderId(oAuthInfo.providerId()) | ||
| .orElseGet(() -> userService.join(oAuthInfo.email(), APPLE, oAuthInfo.providerId())); | ||
| .orElseGet(() -> userRepository.findFirstByEmailOrderByIdAsc(oAuthInfo.email()) | ||
| .orElseGet(() -> userService.join(oAuthInfo.email(), APPLE, oAuthInfo.providerId()))); | ||
|
|
||
| updateAppleUserEmail(user, oAuthInfo.email()); | ||
|
|
||
|
|
@@ -72,13 +74,12 @@ public Tokens appleLoginV2(AppleLoginRequestV2 request) { | |
| OAuthInfo oAuthInfo = appleAuthenticator.getOAuthInfoByIdentityToken(request.identityToken()); | ||
|
|
||
| User user = userRepository.findByProviderId(oAuthInfo.providerId()) | ||
| .orElseGet(() -> userService.joinV2(oAuthInfo.email(), APPLE, oAuthInfo.providerId(),request.deviceType())); | ||
| .orElseGet(() -> userRepository.findFirstByEmailOrderByIdAsc(oAuthInfo.email()) | ||
| .orElseGet(() -> userService.joinV2(oAuthInfo.email(), APPLE, oAuthInfo.providerId(),request.deviceType()))); | ||
|
|
||
| updateAppleUserEmail(user, oAuthInfo.email()); | ||
|
|
||
| if (user.getDeviceType() == null) { | ||
| user.updateDeviceType(request.deviceType()); | ||
| } | ||
| user.updateDeviceType(request.deviceType()); | ||
|
|
||
| return generateOauthJwtTokens(user.getEmail(), APPLE, oAuthInfo.providerId()); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,6 @@ public void updateDepartment(Department department) { | |
| this.department = department; | ||
| } | ||
|
|
||
| // 회원 가입 v2 마이그레이션을 위한 메서드 (원래는 가입시 DeviceType을 받아야 합니다.) | ||
| // 추후에 기종이 바뀌더라도 업데이트합니다. + V1-> V2 마이그레이션을 수행하는 역할을 하기도 합니다. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 리포지토리 스타일 가이드 규칙 #8에 따라 주석에 작성자 이름과 날짜를 포함해야 합니다. References
|
||
| public void updateDeviceType(DeviceType deviceType) { this.deviceType = deviceType; } | ||
| } | ||
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.
리포지토리 스타일 가이드 규칙 #8에 따라 주석에 작성자 이름과 날짜를 포함해야 합니다.
References