Class OidcUserInfoAuthenticationProvider
java.lang.Object
org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationProvider
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public final class OidcUserInfoAuthenticationProvider
extends Object
implements org.springframework.security.authentication.AuthenticationProvider
An
AuthenticationProvider
implementation for OpenID Connect 1.0 UserInfo
Endpoint.- Since:
- 0.2.1
- See Also:
-
Constructor Summary
ConstructorDescriptionOidcUserInfoAuthenticationProvider
(OAuth2AuthorizationService authorizationService) Constructs anOidcUserInfoAuthenticationProvider
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
authenticate
(org.springframework.security.core.Authentication authentication) void
setUserInfoMapper
(Function<OidcUserInfoAuthenticationContext, org.springframework.security.oauth2.core.oidc.OidcUserInfo> userInfoMapper) Sets theFunction
used to extract claims fromOidcUserInfoAuthenticationContext
to an instance ofOidcUserInfo
for the UserInfo response.boolean
-
Constructor Details
-
OidcUserInfoAuthenticationProvider
Constructs anOidcUserInfoAuthenticationProvider
using the provided parameters.- Parameters:
authorizationService
- the authorization service
-
-
Method Details
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException - Specified by:
authenticate
in interfaceorg.springframework.security.authentication.AuthenticationProvider
- Throws:
org.springframework.security.core.AuthenticationException
-
supports
- Specified by:
supports
in interfaceorg.springframework.security.authentication.AuthenticationProvider
-
setUserInfoMapper
public void setUserInfoMapper(Function<OidcUserInfoAuthenticationContext, org.springframework.security.oauth2.core.oidc.OidcUserInfo> userInfoMapper) Sets theFunction
used to extract claims fromOidcUserInfoAuthenticationContext
to an instance ofOidcUserInfo
for the UserInfo response.The
OidcUserInfoAuthenticationContext
gives the mapper access to theOidcUserInfoAuthenticationToken
, as well as, the following context attributes:OidcUserInfoAuthenticationContext.getAccessToken()
containing the bearer token used to make the request.OidcUserInfoAuthenticationContext.getAuthorization()
containing theOidcIdToken
andOAuth2AccessToken
associated with the bearer token used to make the request.
- Parameters:
userInfoMapper
- theFunction
used to extract claims fromOidcUserInfoAuthenticationContext
to an instance ofOidcUserInfo
-