-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Feature] - 카카오 로그인 구현 #55
Changes from 4 commits
2583cc9
63ccece
778d1b6
11684f3
ce2e4e0
b0a0b00
20198e3
4b52f2c
8e979a2
4535fc0
c265ab2
c03e945
554e846
5d6f4c0
c42b09e
859fce1
efa9892
f4406a4
deff84e
b9ec188
2b4913b
62049b0
46bcaac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.web.client.ClientHttpRequestFactories; | ||
import org.springframework.boot.web.client.ClientHttpRequestFactorySettings; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.client.ClientHttpRequestFactory; | ||
import org.springframework.stereotype.Component; | ||
|
@@ -20,7 +21,6 @@ public class KakaoOauthClient { | |
private final String accessTokenRequestUri; | ||
private final String restApiKey; | ||
private final String redirectUri; | ||
|
||
private final RestClient restClient; | ||
|
||
public KakaoOauthClient( | ||
|
@@ -29,17 +29,21 @@ public KakaoOauthClient( | |
@Value("${oauth.kakao.rest-api-key}") String restApiKey, | ||
@Value("${oauth.kakao.redirect-uri}") String redirectUri | ||
) { | ||
this.userInformationRequestUri = userInformationRequestUri; | ||
this.accessTokenRequestUri = accessTokenRequestUri; | ||
this.restApiKey = restApiKey; | ||
this.redirectUri = redirectUri; | ||
this.restClient = buildRestClient(); | ||
} | ||
|
||
private RestClient buildRestClient() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 걍 의견) build말고 |
||
ClientHttpRequestFactorySettings settings = ClientHttpRequestFactorySettings.DEFAULTS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 생성자 로직이 많은 것 같아서 메서드로 빼면 어떨깝쇼 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 좋을것 같답쇼 분리했습니답쇼 |
||
.withConnectTimeout(Duration.ofSeconds(1)) | ||
.withReadTimeout(Duration.ofSeconds(3)); | ||
|
||
ClientHttpRequestFactory requestFactory = ClientHttpRequestFactories.get(settings); | ||
|
||
this.userInformationRequestUri = userInformationRequestUri; | ||
this.accessTokenRequestUri = accessTokenRequestUri; | ||
this.restApiKey = restApiKey; | ||
this.redirectUri = redirectUri; | ||
this.restClient = RestClient.builder() | ||
return RestClient.builder() | ||
.requestFactory(requestFactory) | ||
.build(); | ||
} | ||
|
@@ -49,7 +53,7 @@ public OauthUserInformationResponse requestUserInformation(String authorizationC | |
|
||
return restClient.get() | ||
.uri(userInformationRequestUri) | ||
.header("Authorization", "Bearer " + kakaoAccessTokenResponse.accessToken()) | ||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + kakaoAccessTokenResponse.accessToken()) | ||
.retrieve() | ||
.toEntity(OauthUserInformationResponse.class) | ||
.getBody(); | ||
|
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.
괄호 내려주면 다른 파일이랑 컨벤션이 더 잘 맞을 것 같습니다
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.
반영 완!