Class SocialChainCustomizer
java.lang.Object
com.irurueta.authserver.authorization.api.web.social.SocialChainCustomizer
- All Implemented Interfaces:
LoginChainCustomizer
Customizes the login/UI chain with the sign-in with external providers:
http.oauth2Login(...) with the
client registrations of the configured providers, the user services that resolve the local account, the success
handler that grants the federated factor and, for Apple, the signed client secret and the form post callback.
The endpoints of the framework (/oauth2/authorization/* starts a sign-in, /login/oauth2/code/*
receives the provider's answer) are public. The login page is the server's own, so the provider's page is never
chosen automatically even when one provider is configured. Apple posts its answer to the callback from another site,
so that one callback is exempt from CSRF protection (the state of the authorization request protects it) and
the session cookie must be sent on a cross-site post (see the documentation of the social login). The same
endpoints serve the explicit link flow of the identities page: the success and failure handlers tell a link apart.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether Apple is configured, which posts its answer to the callback.(package private) static final StringPattern of the endpoints that start a sign-in.private final org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolverBuilds the authorization requests.(package private) static final StringPattern of the endpoints that receive the provider's answer.private final org.springframework.security.oauth2.client.registration.ClientRegistrationRepositoryRegistrations of the configured providers.private final org.springframework.security.web.authentication.AuthenticationFailureHandlerSends a refused link back to the identities page, any other failure to the login page.private final FederatedOAuth2UserServiceResolves the account of an OAuth 2.0 sign-in.private final FederatedOidcUserServiceResolves the account of an OpenID Connect sign-in.static final intOrder of the customizer: after the phone page one.private final org.springframework.security.web.context.SecurityContextRepositorySaves the security context of the sign-in.private final org.springframework.security.web.authentication.AuthenticationSuccessHandlerGrants the federated factor and resumes the saved request, or completes a link.private final org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient<org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest> Exchanges the authorization code for tokens. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Customizes the login/UI chain.
-
Field Details
-
ORDER
public static final int ORDEROrder of the customizer: after the phone page one.- See Also:
-
AUTHORIZATION_PATTERN
Pattern of the endpoints that start a sign-in.- See Also:
-
CALLBACK_PATTERN
Pattern of the endpoints that receive the provider's answer.- See Also:
-
clientRegistrationRepository
private final org.springframework.security.oauth2.client.registration.ClientRegistrationRepository clientRegistrationRepositoryRegistrations of the configured providers. -
oidcUserService
Resolves the account of an OpenID Connect sign-in. -
oauth2UserService
Resolves the account of an OAuth 2.0 sign-in. -
successHandler
private final org.springframework.security.web.authentication.AuthenticationSuccessHandler successHandlerGrants the federated factor and resumes the saved request, or completes a link. -
failureHandler
private final org.springframework.security.web.authentication.AuthenticationFailureHandler failureHandlerSends a refused link back to the identities page, any other failure to the login page. -
securityContextRepository
private final org.springframework.security.web.context.SecurityContextRepository securityContextRepositorySaves the security context of the sign-in. -
tokenResponseClient
private final org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient<org.springframework.security.oauth2.client.endpoint.OAuth2AuthorizationCodeGrantRequest> tokenResponseClientExchanges the authorization code for tokens. -
authorizationRequestResolver
private final org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolver authorizationRequestResolverBuilds the authorization requests. -
appleEnabled
private final boolean appleEnabledWhether Apple is configured, which posts its answer to the callback.
-
-
Constructor Details
-
SocialChainCustomizer
public SocialChainCustomizer()
-
-
Method Details
-
customize
public void customize(org.springframework.security.config.annotation.web.builders.HttpSecurity http) Customizes the login/UI chain.- Specified by:
customizein interfaceLoginChainCustomizer- Parameters:
http- security builder of the chain.
-