Skip to content

Commit

Permalink
Merge pull request #14 from eunxeum/main
Browse files Browse the repository at this point in the history
Test: ๋กœ๊ทธ ํ™•์ธ
  • Loading branch information
eunxeum authored Nov 2, 2024
2 parents dfd5ee8 + e8f4fc1 commit c808927
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> properties = oAuth2User.getAttribute("properties");
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit c808927

Please sign in to comment.