-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UsernamePasswordAuthenticationToken을 직접 생성하지 않고,CustomOAuth2UserService의 loadUser메서가 OAuth2User를 구현한 CustomOauth2User를 반환하여 자동으로 OAuth2AuthenticationToken가 생성되도록 설정하여 오류 해결
- Loading branch information
Showing
9 changed files
with
48 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
src/main/java/com/api/TaveShot/global/oauth2/GithubUserInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
package com.api.TaveShot.global.oauth2; | ||
|
||
import static com.api.TaveShot.global.constant.OauthConstant.AVATAR_URL_PATTERN; | ||
import static com.api.TaveShot.global.constant.OauthConstant.PROFILE_IMAGE_URL_PATTERN; | ||
import static com.api.TaveShot.global.constant.OauthConstant.EMAIL_PATTERN; | ||
import static com.api.TaveShot.global.constant.OauthConstant.ID_PATTERN; | ||
import static com.api.TaveShot.global.constant.OauthConstant.LOGIN_PATTERN; | ||
import static com.api.TaveShot.global.constant.OauthConstant.NAME_PATTERN; | ||
|
||
import java.util.Map; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record GithubUserInfo(Map<String, Object> userInfo) { | ||
|
||
public String getProfileImageUrl() { | ||
return (String) userInfo.get(AVATAR_URL_PATTERN); | ||
} | ||
|
||
public String getLoginId() { | ||
return (String) userInfo.get(LOGIN_PATTERN); | ||
} | ||
|
||
public String getName() { | ||
return (String) userInfo.get(NAME_PATTERN); | ||
|
||
public Integer getId() { | ||
return (Integer) userInfo.get(ID_PATTERN); | ||
} | ||
|
||
public String getMail() { | ||
return (String) userInfo.get(EMAIL_PATTERN); | ||
} | ||
|
||
public Long getId() { | ||
return (Long) userInfo.get(ID_PATTERN); | ||
public String getProfileImageUrl() { | ||
return (String) userInfo.get(PROFILE_IMAGE_URL_PATTERN); | ||
} | ||
} |