diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java index c0c27e4644..813042fc7f 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OAuth2LoginConfigurer.java @@ -206,10 +206,10 @@ public final class OAuth2LoginConfigurer> exten return this; } - public UserInfoEndpointConfig customUserType(Class extends OAuth2User> customUserType, String userInfoUri) { + public UserInfoEndpointConfig customUserType(Class extends OAuth2User> customUserType, String clientRegistrationId) { Assert.notNull(customUserType, "customUserType cannot be null"); - Assert.hasText(userInfoUri, "userInfoUri cannot be empty"); - this.customUserTypes.put(userInfoUri, customUserType); + Assert.hasText(clientRegistrationId, "clientRegistrationId cannot be empty"); + this.customUserTypes.put(clientRegistrationId, customUserType); return this; } diff --git a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserService.java b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserService.java index 1b0d23ce3d..471768d11f 100644 --- a/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserService.java +++ b/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/userinfo/CustomUserTypesOAuth2UserService.java @@ -15,6 +15,7 @@ */ package org.springframework.security.oauth2.client.userinfo; +import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.core.OAuth2AuthenticationException; import org.springframework.security.oauth2.core.user.OAuth2User; import org.springframework.util.Assert; @@ -28,7 +29,7 @@ import java.util.Map; *
* The custom user type(s) is supplied via the constructor,
* using a Map
of {@link OAuth2User} type keyed by String
,
- * representing the UserInfo Endpoint address.
+ * which represents the {@link ClientRegistration#getRegistrationId() Registration Id} of the Client.
*
* This implementation uses a {@link UserInfoRetriever} to obtain the user attributes
* of the End-User (Resource Owner) from the UserInfo Endpoint.
@@ -39,6 +40,7 @@ import java.util.Map;
* @see OAuth2UserRequest
* @see OAuth2User
* @see UserInfoRetriever
+ * @see ClientRegistration
*/
public class CustomUserTypesOAuth2UserService implements OAuth2UserService