feat : Naver 로그인 타입 추가
This commit is contained in:
@@ -5,7 +5,8 @@ enum class OAuth2Type(
|
||||
private val createUserInfo: (attributes: Map<String, Any?>) -> OAuth2UserInfo
|
||||
) {
|
||||
GOOGLE("google", { attributes -> GoogleUserInfo(attributes) }),
|
||||
FACEBOOK("facebook", { attributes -> FacebookUserInfo(attributes) });
|
||||
FACEBOOK("facebook", { attributes -> FacebookUserInfo(attributes) }),
|
||||
NAVER("naver", { attributes -> NaverUserInfo(attributes) });
|
||||
|
||||
fun createOAuth2UserInfo(attributes: Map<String, Any?>): OAuth2UserInfo {
|
||||
return createUserInfo(attributes)
|
||||
|
||||
@@ -53,5 +53,33 @@ class FacebookUserInfo(
|
||||
override fun getName(): String {
|
||||
return attributes["name"] as String
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class NaverUserInfo(
|
||||
/**
|
||||
* DefaultOAuth2Service#loadUser(OAuth2UserRequest)
|
||||
* ```kotlin
|
||||
* val oAuth2User = super.loadUser(userRequest)
|
||||
* val attributes = oAuth2User.attributes
|
||||
* ```
|
||||
*/
|
||||
private val attributes: Map<String, Any?>
|
||||
): OAuth2UserInfo {
|
||||
private val response = attributes["response"] as Map<*, *>
|
||||
|
||||
override fun getProviderId(): String {
|
||||
return response["id"] as String
|
||||
}
|
||||
|
||||
override fun getProvider(): String {
|
||||
return "naver"
|
||||
}
|
||||
|
||||
override fun getEmail(): String {
|
||||
return response["email"] as String
|
||||
}
|
||||
|
||||
override fun getName(): String {
|
||||
return response["name"] as String
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user