Class OidcUserService
java.lang.Object
org.springframework.security.oauth2.client.oidc.userinfo.OidcUserService
- All Implemented Interfaces:
OAuth2UserService<OidcUserRequest,OidcUser>
An implementation of an
OAuth2UserService that supports OpenID Connect 1.0
Provider's.- Since:
- 5.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the defaultConverter's used for type conversion of claim values for anOidcUserInfo.loadUser(OidcUserRequest userRequest) Returns anOAuth2Userafter obtaining the user attributes of the End-User from the UserInfo Endpoint.final voidsetClaimTypeConverterFactory(Function<ClientRegistration, org.springframework.core.convert.converter.Converter<Map<String, Object>, Map<String, Object>>> claimTypeConverterFactory) Sets the factory that provides aConverterused for type conversion of claim values for anOidcUserInfo.final voidsetOauth2UserService(OAuth2UserService<OAuth2UserRequest, OAuth2User> oauth2UserService) Sets theOAuth2UserServiceused when requesting the user info resource.voidsetOidcUserConverter(org.springframework.core.convert.converter.Converter<OidcUserSource, OidcUser> oidcUserConverter) Allows converting from theOidcUserSourceto andOidcUser.final voidsetRetrieveUserInfo(Predicate<OidcUserRequest> retrieveUserInfo) Sets thePredicateused to determine if the UserInfo Endpoint should be called to retrieve information about the End-User (Resource Owner).
-
Constructor Details
-
OidcUserService
public OidcUserService()
-
-
Method Details
-
createDefaultClaimTypeConverters
public static Map<String,org.springframework.core.convert.converter.Converter<Object, createDefaultClaimTypeConverters()?>> Returns the defaultConverter's used for type conversion of claim values for anOidcUserInfo.- Returns:
- a
MapofConverter's keyed byclaim name - Since:
- 5.2
-
loadUser
Description copied from interface:OAuth2UserServiceReturns anOAuth2Userafter obtaining the user attributes of the End-User from the UserInfo Endpoint.- Specified by:
loadUserin interfaceOAuth2UserService<OidcUserRequest,OidcUser> - Parameters:
userRequest- the user request- Returns:
- an
OAuth2User - Throws:
OAuth2AuthenticationException- if an error occurs while attempting to obtain the user attributes from the UserInfo Endpoint
-
setOauth2UserService
public final void setOauth2UserService(OAuth2UserService<OAuth2UserRequest, OAuth2User> oauth2UserService) Sets theOAuth2UserServiceused when requesting the user info resource.- Parameters:
oauth2UserService- theOAuth2UserServiceused when requesting the user info resource.- Since:
- 5.1
-
setClaimTypeConverterFactory
public final void setClaimTypeConverterFactory(Function<ClientRegistration, org.springframework.core.convert.converter.Converter<Map<String, Object>, Map<String, Object>>> claimTypeConverterFactory) Sets the factory that provides aConverterused for type conversion of claim values for anOidcUserInfo. The default isClaimTypeConverterfor allclients.- Parameters:
claimTypeConverterFactory- the factory that provides aConverterused for type conversion of claim values for a specificclient- Since:
- 5.2
-
setRetrieveUserInfo
Sets thePredicateused to determine if the UserInfo Endpoint should be called to retrieve information about the End-User (Resource Owner).By default, the UserInfo Endpoint is called if all the following are true:
- The user info endpoint is defined on the ClientRegistration
- The Client Registration uses the
AuthorizationGrantType.AUTHORIZATION_CODE
- Parameters:
retrieveUserInfo- thePredicateused to determine if the UserInfo Endpoint should be called- Since:
- 6.3
-
setOidcUserConverter
public void setOidcUserConverter(org.springframework.core.convert.converter.Converter<OidcUserSource, OidcUser> oidcUserConverter) Allows converting from theOidcUserSourceto andOidcUser.- Parameters:
oidcUserConverter- theConverterto use. Cannot be null.
-