Skip to content

Commit

Permalink
Merge pull request #186 from 1223v/login
Browse files Browse the repository at this point in the history
Fix: APPLE_NAME 분기문 처리 수정
  • Loading branch information
1223v authored Feb 28, 2024
2 parents 4940f19 + a41cf61 commit 69ba195
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.readyvery.readyverydemo.domain.Role;
import com.readyvery.readyverydemo.domain.SocialType;
import com.readyvery.readyverydemo.domain.UserInfo;
import com.readyvery.readyverydemo.domain.repository.UserRepository;
Expand Down Expand Up @@ -59,18 +58,18 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
System.out.println("userNameAttributeName = " + userNameAttributeName);

// socialType에 따라 유저 정보를 통해 OAuthAttributes 객체 생성
//OAuthAttributes extractAttributes = OAuthAttributes.of(socialType, userNameAttributeName, attributes);
OAuthAttributes extractAttributes = OAuthAttributes.of(socialType, userNameAttributeName, attributes);

//System.out.println("extractAttributes = " + extractAttributes);
// UserInfo createdUser = getUser(extractAttributes, socialType); // getUser() 메소드로 User 객체 생성 후 반환
// System.out.println("createdUser = " + createdUser);
System.out.println("extractAttributes = " + extractAttributes);
UserInfo createdUser = getUser(extractAttributes, socialType); // getUser() 메소드로 User 객체 생성 후 반환
System.out.println("createdUser = " + createdUser);
// CustomOAuth2User 객체 생성
return new CustomOAuth2User(
Collections.singleton(new SimpleGrantedAuthority("ROLE_GUEST")),
Collections.singleton(new SimpleGrantedAuthority(createdUser.getRole().getKey())),
attributes,
userNameAttributeName,
"createdUser.getEmail()",
Role.GUEST
extractAttributes.getNameAttributeKey(),
createdUser.getEmail(),
createdUser.getRole()
);
} else {
OAuth2User oAuth2User = delegate.loadUser(userRequest);
Expand Down Expand Up @@ -104,7 +103,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
private SocialType getSocialType(String registrationId) {
if (KAKAO_NAME.equals(registrationId)) {
return SocialType.KAKAO;
} else if (APPLE_NAME.equals(registrationId)) {
} else if (APPLE_NAME.contains(registrationId)) {

return SocialType.APPLE;
}
Expand Down

0 comments on commit 69ba195

Please sign in to comment.