-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/#84 add oauth #85
Merged
Merged
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
499e985
refactor: oauth ๊ฐ๋ฐ ์ ํด๋ ๊ตฌ์กฐ ๋ฆฌํฉํ ๋ง
dong2ast 739fd3d
feat: oauth2 ๊ด๋ จ ์ด๊ธฐ ์ค์ ๋ฐ google ๋ก๊ทธ์ธ ๊ตฌํ | member ๋๋ฉ์ธ ์ฐ๊ฒฐ์ ๋ํ ์ธ๋ถ์ฌํญ์ ์์ง ๊ตฌํ x
dong2ast 01a5911
feat: oauth ํ์ ๊ฐ์
๋ก์ง ๋ฐ ๋ก๊ทธ์ธ ๋ก์ง ๊ตฌํ | ํ์ ๊ฐ์
ํ ์ถ๊ฐ์ ๋ณด ๋ฆฌ๋ค์ด๋ ํ
ํ์
dong2ast 922202d
feat: oauth ํ์ ๊ฐ์
ํ ์ถ๊ฐ์ ๋ณด ์ฌ์ดํธ๋ก ๋ฆฌ๋ค์ด๋ ํธ ๋ฐ ํ ํฐ ๋ฐํ ๋ก์ง ๊ตฌํ
dong2ast 0b50264
feat: Member ํ๋์ social ID ํ๋ ์ถ๊ฐ ๋ฐ ํด๋น ๊ฐ์ผ๋ก ํ์๊ฐ์
์ฌ๋ถ ์กฐํ ๋ก์ง ๊ตฌํ (๊ตฌ๊ธ, ๋ค์ด๋ฒ, โฆ
dong2ast 301c007
feat: ์์
๋ก๊ทธ์ธ ์คํจ handler ์ถ๊ฐ
dong2ast bea4040
Add/#82 fix auditing (#83)
dong2ast c2937f9
refactor: oauth ๊ฐ๋ฐ ์ ํด๋ ๊ตฌ์กฐ ๋ฆฌํฉํ ๋ง
dong2ast 45a2139
feat: oauth2 ๊ด๋ จ ์ด๊ธฐ ์ค์ ๋ฐ google ๋ก๊ทธ์ธ ๊ตฌํ | member ๋๋ฉ์ธ ์ฐ๊ฒฐ์ ๋ํ ์ธ๋ถ์ฌํญ์ ์์ง ๊ตฌํ x
dong2ast 3cf057b
feat: oauth ํ์ ๊ฐ์
๋ก์ง ๋ฐ ๋ก๊ทธ์ธ ๋ก์ง ๊ตฌํ | ํ์ ๊ฐ์
ํ ์ถ๊ฐ์ ๋ณด ๋ฆฌ๋ค์ด๋ ํ
ํ์
dong2ast abc1752
feat: oauth ํ์ ๊ฐ์
ํ ์ถ๊ฐ์ ๋ณด ์ฌ์ดํธ๋ก ๋ฆฌ๋ค์ด๋ ํธ ๋ฐ ํ ํฐ ๋ฐํ ๋ก์ง ๊ตฌํ
dong2ast f5c43d9
feat: Member ํ๋์ social ID ํ๋ ์ถ๊ฐ ๋ฐ ํด๋น ๊ฐ์ผ๋ก ํ์๊ฐ์
์ฌ๋ถ ์กฐํ ๋ก์ง ๊ตฌํ (๊ตฌ๊ธ, ๋ค์ด๋ฒ, โฆ
dong2ast 118e176
feat: ์์
๋ก๊ทธ์ธ ์คํจ handler ์ถ๊ฐ
dong2ast 471ed1e
Merge remote-tracking branch 'origin/feat/#84-add-oauth' into feat/#8โฆ
dong2ast 47de284
feat: ์์
๋ก๊ทธ์ธ ์ ์ฉ ํ์๊ฐ์
controller ์์ฑ | ์ฒซ ์์
๋ก๊ทธ์ธ์ ๋ฐ๊ธ๋ access token์ ํตํด ๊ฒ์ฆ
dong2ast c9c00ed
fix: auditing ์๋ฌ ์์
dong2ast 51e896a
feat: ์์
๋ก๊ทธ์ธ ํ์๊ฐ์
๊ธฐ๋ฅ ๊ตฌํ (์์๋ก ๋ง๋ ๊ฐ์ฒด์ ์๋ก ํ์๊ฐ์
ํ ๋ฐ์ดํฐ ๋ฃ๊ธฐ)
dong2ast 513906c
fix: Jwt ๊ธฐ์กด ์ธ์ฆ ํ ํฐ์ ๋ง๊ฒ Oauth2 ๋ณ๊ฒฝํ๋ ๋ก์ง ์ถ๊ฐ
dong2ast 445dbc3
refactor: ๋ง๊ฐ์๋ฐ ๋ถํ ํฌ ์กฐํ ๋ฆฌํฉํ ๋ง (#87)
onpyeong 5a8a770
fix: unused import ์ ๊ฑฐ
dong2ast 3775f87
chore: ์ฃผ์ ๋ณ๊ฒฝ
dong2ast 55fd04b
feat: ์นด์นด์ค, ๋ค์ด๋ฒ ์์
๋ก๊ทธ์ธ ๊ตฌํ
dong2ast File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
32 changes: 32 additions & 0 deletions
32
src/main/java/org/sophy/sophy/config/auth/CustomOAuth2User.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.sophy.sophy.config.auth; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
import lombok.Getter; | ||
import org.sophy.sophy.domain.enumerate.Authority; | ||
import org.springframework.security.core.GrantedAuthority; | ||
import org.springframework.security.oauth2.core.user.DefaultOAuth2User; | ||
|
||
@Getter | ||
public class CustomOAuth2User extends DefaultOAuth2User { | ||
|
||
private final String email; | ||
private final Authority authority; | ||
|
||
/** | ||
* Constructs a {@code DefaultOAuth2User} using the provided parameters. | ||
* | ||
* @param authorities the authorities granted to the user | ||
* @param attributes the attributes about the user | ||
* @param nameAttributeKey the key used to access the user's "name" from | ||
* {@link #getAttributes()} | ||
*/ | ||
public CustomOAuth2User( | ||
Collection<? extends GrantedAuthority> authorities, | ||
Map<String, Object> attributes, String nameAttributeKey, | ||
String email, Authority authority) { | ||
super(authorities, attributes, nameAttributeKey); | ||
this.email = email; | ||
this.authority = authority; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...sophy/sophy/config/JwtSecurityConfig.java โ .../sophy/config/auth/JwtSecurityConfig.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
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
77 changes: 77 additions & 0 deletions
77
src/main/java/org/sophy/sophy/config/auth/common/CustomOAuth2UserService.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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package org.sophy.sophy.config.auth.common; | ||
|
||
import java.util.Collections; | ||
import lombok.RequiredArgsConstructor; | ||
import org.sophy.sophy.config.auth.CustomOAuth2User; | ||
import org.sophy.sophy.config.auth.dto.OAuthAttributes; | ||
import org.sophy.sophy.domain.Member; | ||
import org.sophy.sophy.infrastructure.MemberRepository; | ||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService; | ||
import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest; | ||
import org.springframework.security.oauth2.client.userinfo.OAuth2UserService; | ||
import org.springframework.security.oauth2.core.OAuth2AuthenticationException; | ||
import org.springframework.security.oauth2.core.user.OAuth2User; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> { | ||
|
||
private final MemberRepository memberRepository; | ||
|
||
@Override | ||
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException { | ||
/** | ||
* DefaultOAuth2UserService ๊ฐ์ฒด๋ฅผ ์์ฑํ์ฌ, loadUser(userRequest)๋ฅผ ํตํด DefaultOAuth2User ๊ฐ์ฒด๋ฅผ ์์ฑ ํ ๋ฐํ | ||
* DefaultOAuth2UserService์ loadUser()๋ ์์ ๋ก๊ทธ์ธ API์ ์ฌ์ฉ์ ์ ๋ณด ์ ๊ณต URI๋ก ์์ฒญ์ ๋ณด๋ด์ | ||
* ์ฌ์ฉ์ ์ ๋ณด๋ฅผ ์ป์ ํ, ์ด๋ฅผ ํตํด DefaultOAuth2User ๊ฐ์ฒด๋ฅผ ์์ฑ ํ ๋ฐํํ๋ค. | ||
* ๊ฒฐ๊ณผ์ ์ผ๋ก, OAuth2User๋ OAuth ์๋น์ค์์ ๊ฐ์ ธ์จ ์ ์ ์ ๋ณด๋ฅผ ๋ด๊ณ ์๋ ์ ์ | ||
*/ | ||
OAuth2UserService<OAuth2UserRequest, OAuth2User> delegate = new DefaultOAuth2UserService(); | ||
OAuth2User oAuth2User = delegate.loadUser(userRequest); // OAuth2 ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ต๋๋ค. | ||
|
||
//ํ์ฌ ๋ก๊ทธ์ธ ์งํ ์ค์ธ ์๋น์ค๋ฅผ ๊ตฌ๋ถํ๋ ์ฝ๋ (๊ตฌ๊ธ or ๋ค์ด๋ฒ or ์นด์นด์ค ...) | ||
String registrationId = userRequest.getClientRegistration().getRegistrationId(); | ||
//OAuth2 ๋ก๊ทธ์ธ ์งํ ์ ํค๊ฐ๋๋ ํ๋ ๊ฐ, Primary Key์ ๊ฐ์ ์๋ฏธ | ||
String userNameAttributeName = userRequest.getClientRegistration().getProviderDetails() | ||
.getUserInfoEndpoint().getUserNameAttributeName(); | ||
|
||
//OAuth2UserService๋ฅผ ํตํด ๊ฐ์ ธ์จ OAuth2User์ attribute๋ฅผ ๋ด์ ํด๋์ค | ||
// ์์ ๋ก๊ทธ์ธ์์ API๊ฐ ์ ๊ณตํ๋ userInfo์ Json ๊ฐ(์ ์ ์ ๋ณด๋ค) | ||
OAuthAttributes attributes = OAuthAttributes.of(registrationId, userNameAttributeName, | ||
oAuth2User.getAttributes()); | ||
|
||
Member member = getMember(attributes); | ||
|
||
return new CustomOAuth2User( | ||
Collections.singleton(new SimpleGrantedAuthority(member.getAuthority().getKey())), | ||
oAuth2User.getAttributes(), | ||
attributes.getNameAttributeKey(), | ||
member.getEmail(), | ||
member.getAuthority() | ||
); | ||
} | ||
|
||
private Member getMember(OAuthAttributes attributes) { | ||
Member findMember = memberRepository.findBySocialId( | ||
attributes.getOAuth2UserInfo().getId()).orElse(null); | ||
|
||
if (findMember == null) { | ||
return saveMember(attributes); | ||
} | ||
return findMember; | ||
} | ||
|
||
/** | ||
* ์ด๋ฏธ ์กด์ฌํ๋ ํ์์ด๋ผ๋ฉด ์ด๋ฆ๊ณผ ํ๋กํ์ด๋ฏธ์ง๋ฅผ ์ ๋ฐ์ดํธํด์ค๋๋ค. | ||
* ์ฒ์ ๊ฐ์ ํ๋ ํ์์ด๋ผ๋ฉด Member ํ ์ด๋ธ์ ์์ฑํฉ๋๋ค. (์์ ํ์๊ฐ์ ) | ||
**/ | ||
private Member saveMember(OAuthAttributes attributes) { | ||
//๊ธฐ์กด ์ ์ ๋ ์ด๋ฉ์ผ ์ธ์ฆ์ ํ๊ธฐ์, ๋์ด ์ด๋ฉ์ผ์ด ๊ฐ์ผ๋ฉด ๊ฐ์ ์ ์ ์ | ||
// update๋ ๊ธฐ์กด ์ ์ ์ ์์ ID ์ปฌ๋ผ์ ๊ฐ์ ์ถ๊ฐํ๋ ๊ฒ ์ ๋๋ง ์์ผ๋ฉด ๋ ๋ฏ | ||
Member member = attributes.toEntity(attributes.getOAuth2UserInfo()); | ||
return memberRepository.save(member); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/sophy/sophy/config/auth/common/OAuth2LoginFailureHandler.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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.sophy.sophy.config.auth.common; | ||
|
||
import java.io.IOException; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.security.core.AuthenticationException; | ||
import org.springframework.security.web.authentication.AuthenticationFailureHandler; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class OAuth2LoginFailureHandler implements AuthenticationFailureHandler { | ||
|
||
@Override | ||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, | ||
AuthenticationException exception) throws IOException, ServletException { | ||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST); | ||
response.getWriter().write("์์ ๋ก๊ทธ์ธ์ด ์คํจํ์์ต๋๋ค."); | ||
log.error("์์ ๋ก๊ทธ์ธ์ ์คํจํ์ต๋๋ค. ์๋ฌ๋ฉ์ธ์ง : {}", exception.getMessage()); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/org/sophy/sophy/config/auth/common/OAuth2LoginSuccessHandler.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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.sophy.sophy.config.auth.common; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.sophy.sophy.common.dto.ApiResponseDto; | ||
import org.sophy.sophy.config.auth.CustomOAuth2User; | ||
import org.sophy.sophy.controller.dto.response.TokenDto; | ||
import org.sophy.sophy.domain.Member; | ||
import org.sophy.sophy.domain.enumerate.Authority; | ||
import org.sophy.sophy.exception.SuccessStatus; | ||
import org.sophy.sophy.infrastructure.MemberRepository; | ||
import org.sophy.sophy.jwt.TokenProvider; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class OAuth2LoginSuccessHandler implements AuthenticationSuccessHandler { | ||
|
||
private final TokenProvider tokenProvider; | ||
private final MemberRepository memberRepository; | ||
private final RedisTemplate redisTemplate; | ||
private final ObjectMapper mapper = new ObjectMapper(); | ||
|
||
@Override | ||
@Transactional | ||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, | ||
Authentication authentication) throws IOException, ServletException { | ||
CustomOAuth2User customOAuth2User = (CustomOAuth2User) authentication.getPrincipal(); | ||
|
||
// User์ Role์ด GUEST์ผ ๊ฒฝ์ฐ ์ฒ์ ์์ฒญํ ํ์์ด๋ฏ๋ก ํ์๊ฐ์ ํ์ด์ง๋ก ๋ฆฌ๋ค์ด๋ ํธ | ||
if(customOAuth2User.getAuthority() == Authority.GUEST) { | ||
response.sendRedirect("/auth/signup"); // ํ๋ก ํธ์ ํ์๊ฐ์ ์ถ๊ฐ ์ ๋ณด ์ ๋ ฅ ํผ์ผ๋ก ๋ฆฌ๋ค์ด๋ ํธ (์ถ๊ฐ ์ปจํธ๋กค๋ฌ๋ฅผ ๋ง๋ค๊ณ ๊ฑฐ๊ธฐ์ post ํด์ผ์ง User๋ก ๋ฐ๋๊ฒ ํด์ผ๊ฒ ๋ค) | ||
|
||
//์๋์ GUEST๋ฅผ USER๋ก ๋ฐ๊ฟ์ฃผ๋ ๋ก์ง์ ํ์๊ฐ์ ์น์ธ๋๋ฉด์ ์ฒ๋ฆฌ๋๊ฒ ๋ณ๊ฒฝ | ||
Member findUser = memberRepository.getMemberByEmail(customOAuth2User.getEmail()); | ||
findUser.authorizeUser(); | ||
} else { | ||
TokenDto tokenDto = tokenProvider.generateTokenDto(authentication); | ||
redisTemplate.opsForValue().set("RT:" + authentication.getName(), | ||
tokenDto.getRefreshToken(), | ||
tokenProvider.getRefreshTokenExpireTime(), | ||
TimeUnit.MILLISECONDS); | ||
response.setStatus(HttpServletResponse.SC_OK); | ||
response.setContentType("application/json"); | ||
response.setCharacterEncoding("utf-8"); | ||
response.getWriter().write(mapper.writeValueAsString( | ||
ApiResponseDto.success(SuccessStatus.LOGIN_SUCCESS, | ||
tokenDto) | ||
)); | ||
// ๋ก๊ทธ์ธ์ ์ฑ๊ณตํ ๊ฒฝ์ฐ access, refresh ํ ํฐ ์์ฑ | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/sophy/sophy/config/auth/dto/GoogleOAuth2UserInfo.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.sophy.sophy.config.auth.dto; | ||
|
||
import java.util.Map; | ||
|
||
public class GoogleOAuth2UserInfo extends OAuth2UserInfo{ | ||
|
||
public GoogleOAuth2UserInfo(Map<String, Object> attributes) { | ||
super(attributes); | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return (String) attributes.get("sub"); | ||
} | ||
|
||
@Override | ||
public String getNickname() { | ||
return (String) attributes.get("name"); | ||
|
||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/org/sophy/sophy/config/auth/dto/KakaoOAuth2UserInfo.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.sophy.sophy.config.auth.dto; | ||
|
||
import java.util.Map; | ||
|
||
public class KakaoOAuth2UserInfo extends OAuth2UserInfo{ | ||
|
||
public KakaoOAuth2UserInfo(Map<String, Object> attributes) { | ||
super(attributes); | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return String.valueOf(attributes.get("id")); | ||
} | ||
|
||
@Override | ||
public String getNickname() { | ||
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account"); | ||
Map<String, Object> profile = (Map<String, Object>) account.get("profile"); | ||
|
||
if (profile == null) { | ||
return null; | ||
} | ||
|
||
return (String) profile.get("nickname"); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadUser ํจ์๊ฐ ์์ ๋ก๊ทธ์ธ ํ์ ๋ ์ ์ ์ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ ๊ฐ์๋ฐ ์ด ํจ์ ํธ์ถ ์์ ์ด ์ธ์ ์ธ๊ฐ์,,?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ฌ์ฉ์๊ฐ ์์ ๋ก๊ทธ์ธ ์๋ -> ๊ตฌ๊ธ Authentication ์๋ฒ๋ก Redirect -> ์ฌ์ฉ์ ์ ๋ณด ์ ๊ณต ๋์ -> ์ฐ๋ฆฌ ์๋ฒ์ ์ธ์ฆ์ฝ๋ ๋ฐ๊ธ -> ์ธ์ฆ์ฝ๋๋ก ๊ตฌ๊ธ Authentication ์๋ฒ์ access token ๋ฐ๊ธ ์์ฒญ -> ๋ฐ์ access token์ผ๋ก ๊ตฌ๊ธ Resourse ์๋ฒ์ ์ฌ์ฉ์ ์ ๋ณด ์์ฒญ
์ฌ๊ธฐ์ ์ ๋ณด๋ฅผ ๊ฐ์ ธ์ฌ ๋ loadUser ๋ฉ์๋๊ฐ ์คํ๋๊ฒ ๋ฉ๋๋ค.
ํ์ฌ ์ด ์ฝ๋์์ ์์ ๋ก๊ทธ์ธํ ์ ์ ๊ฐ ์ฐ๋ฆฌ ์๋น์ค์ ํ์์ธ์ง๋ฅผ ํ์ธํ๋ ๊ธฐ๋ฅ์ ํ๊ณ ์๊ณ , ์ฌ๊ธฐ์ ๋ฐํ๋๋ OAuth2User ๊ฐ์ฒด๋ ์คํ๋ง ์ธ์ ์ ์ ์ฅ๋๊ฒ ๋ฉ๋๋ค~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ค ๊ทธ๋ฆผ์ผ๋ก ๋ณด๋๊น ์์ ์ ์ดํด๋์ต๋๋ค!๐