From 82f13ae082672df17207272ecc2e0585a508136a Mon Sep 17 00:00:00 2001 From: amm0124 Date: Tue, 12 Nov 2024 17:54:39 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=95=88=20=EC=93=B0=EB=8A=94=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../userdetail/OAuth2UserDetailServiceImpl.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java b/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java index a595b326..e3923435 100644 --- a/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java +++ b/src/main/java/poomasi/domain/auth/security/userdetail/OAuth2UserDetailServiceImpl.java @@ -18,7 +18,6 @@ import java.util.Map; @Service -@Description("소셜 서비스와 로컬 계정 연동 할 것이라면 여기서 연동 해야 함") @Slf4j public class OAuth2UserDetailServiceImpl extends DefaultOAuth2UserService { @@ -44,33 +43,29 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic } else{ log.warn("지원하지 않은 로그인 서비스 입니다."); } - + + // 정보 추출 String providerId = oAuth2UserInfo.getProviderId(); String email = oAuth2UserInfo.getEmail(); Role role = Role.ROLE_CUSTOMER; LoginType loginType = oAuth2UserInfo.getLoginType(); - - - //일단 없으면 가입시키는 쪽으로 구현ㄴ + + // 카카오 로그인을 처음 한 상태라면 회원가입 Member member = memberRepository.findByEmailAndDeletedAtIsNull(email).orElse(null); if(member == null) { member = Member.builder() .email(email) .role(role) - .loginType(loginType) // loginType에 맞게 변경 + .loginType(loginType) .provideId(providerId) .memberProfile(new MemberProfile()) .build(); memberRepository.save(member); - } //있다면 그냥 member 등록하기 - if(member.getLoginType()==LoginType.LOCAL){ - //member.setProviderId(providerId); -> 로그인 시 Id 조회함 - } // 카카오 회원으로 로그인이 되어 있다면 -> context에 저장 return new UserDetailsImpl(member, oAuth2User.getAttributes());