diff --git a/src/main/java/com/example/moyeothon/Config/OAuth2/CustomOAuth2UserService.java b/src/main/java/com/example/moyeothon/Config/OAuth2/CustomOAuth2UserService.java index 73fc342..61cdbdc 100644 --- a/src/main/java/com/example/moyeothon/Config/OAuth2/CustomOAuth2UserService.java +++ b/src/main/java/com/example/moyeothon/Config/OAuth2/CustomOAuth2UserService.java @@ -30,10 +30,14 @@ public class CustomOAuth2UserService extends DefaultOAuth2UserService { public OAuth2User loadUser(OAuth2UserRequest userRequest) { OAuth2User oAuth2User = super.loadUser(userRequest); + logger.info("요기1"); + String registrationId = userRequest.getClientRegistration().getRegistrationId(); String userNameAttributeName = userRequest.getClientRegistration().getProviderDetails() .getUserInfoEndpoint().getUserNameAttributeName(); + logger.info("요기2"); + // Kakao 사용자 정보 추출 Long id = oAuth2User.getAttribute(userNameAttributeName); Map properties = oAuth2User.getAttribute("properties"); @@ -65,9 +69,13 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) { userRepository.save(userEntity); } + logger.info("요기3"); + // 권한 설정 GrantedAuthority authority = new SimpleGrantedAuthority("ROLE_USER"); + logger.info("요기4"); + // OAuth2User 반환 return new CustomOAuth2User(userEntity, Collections.singletonList(authority), oAuth2User.getAttributes()); }