Class SocialConfiguration
java.lang.Object
com.irurueta.authserver.authorization.api.web.social.SocialConfiguration
@Configuration(value="socialWebConfiguration",
proxyBeanMethods=false)
@Conditional(SocialProvidersCondition.class)
@EnableConfigurationProperties(SocialProperties.class)
public class SocialConfiguration
extends Object
Installs the sign-in with external providers in the login/UI chain. Nothing outside this feature is edited: the chain
applies every
LoginChainCustomizer bean, in order, before its catch-all rule. All of it hangs from
SocialProvidersCondition: with no provider configured there is no bean here at all, so the application
behaves exactly as it does without the feature.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classDeclares the generator of the Apple client secret, only while Apple is configured. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfederatedAccountResolver(ResolveFederatedLoginUseCase useCase, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, LinkIdentityUseCase linkIdentityUseCase, PendingIdentityLinks pendingIdentityLinks) Declares the resolver of the local account of a sign-in, with the account status rules of the other sign-in methods.federatedFactorSelector(SocialProperties properties, FederatedUserMapper mapper) Declares the selector of the factor a sign-in proved.federatedOAuth2UserService(VerifiedEmailLookup verifiedEmailLookup, FederatedAccountResolver resolver, FederatedUserMapper mapper) Declares the user service of the OAuth 2.0 providers (GitHub).federatedOidcUserService(FederatedAccountResolver resolver, FederatedUserMapper mapper) Declares the user service of the OpenID Connect providers.socialChainCustomizer(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository repository, FederatedOidcUserService oidcService, FederatedOAuth2UserService oauth2Service, FactorGrantor grantor, FederatedFactorSelector selector, org.springframework.beans.factory.ObjectProvider<AppleClientSecretGenerator> apple, PendingIdentityLinks pendingIdentityLinks) Declares the customizer that enableshttp.oauth2Login(...).org.springframework.security.oauth2.client.registration.ClientRegistrationRepositorysocialClientRegistrationRepository(SocialProperties properties, ClientRegistrationMapper mapper) Declares the registrations of the configured providers; the repository cannot be empty, which is why this configuration exists only when one provider is configured at least.org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration> socialIdTokenDecoderFactory(SocialProperties properties) Declares the factory of the ID token decoders, with the validators ofIdTokenValidatorFactory(the issuer of a multi-tenant Microsoft Entra ID token is checked against the token's tenant).socialLoginMethodFragment(SocialProperties properties) Declares the link of each configured provider on the login page.
-
Constructor Details
-
SocialConfiguration
public SocialConfiguration()
-
-
Method Details
-
socialIdTokenDecoderFactory
@Bean public org.springframework.security.oauth2.jwt.JwtDecoderFactory<org.springframework.security.oauth2.client.registration.ClientRegistration> socialIdTokenDecoderFactory(SocialProperties properties) Declares the factory of the ID token decoders, with the validators ofIdTokenValidatorFactory(the issuer of a multi-tenant Microsoft Entra ID token is checked against the token's tenant).- Parameters:
properties- settings of the providers.- Returns:
- the factory.
-
federatedAccountResolver
@Bean public FederatedAccountResolver federatedAccountResolver(ResolveFederatedLoginUseCase useCase, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, LinkIdentityUseCase linkIdentityUseCase, PendingIdentityLinks pendingIdentityLinks) Declares the resolver of the local account of a sign-in, with the account status rules of the other sign-in methods.- Parameters:
useCase- use case that finds, links or provisions the account.userDetailsService- loads the accounts.linkIdentityUseCase- links an identity to the signed-in account (the explicit link flow).pendingIdentityLinks- the link markers of the explicit link flow.- Returns:
- the resolver.
-
federatedOidcUserService
@Bean public FederatedOidcUserService federatedOidcUserService(FederatedAccountResolver resolver, FederatedUserMapper mapper) Declares the user service of the OpenID Connect providers.- Parameters:
resolver- resolves the account.mapper- builds the local principal.- Returns:
- the service.
-
federatedOAuth2UserService
@Bean public FederatedOAuth2UserService federatedOAuth2UserService(VerifiedEmailLookup verifiedEmailLookup, FederatedAccountResolver resolver, FederatedUserMapper mapper) Declares the user service of the OAuth 2.0 providers (GitHub).- Parameters:
verifiedEmailLookup- reads the verified e-mail address (the GitHub adapter).resolver- resolves the account.mapper- builds the local principal.- Returns:
- the service.
-
federatedFactorSelector
@Bean public FederatedFactorSelector federatedFactorSelector(SocialProperties properties, FederatedUserMapper mapper) Declares the selector of the factor a sign-in proved.- Parameters:
properties- settings of the providers.mapper- reads the upstreamamr.- Returns:
- the selector.
-
socialLoginMethodFragment
Declares the link of each configured provider on the login page.- Parameters:
properties- settings of the providers.- Returns:
- the fragment.
-
socialChainCustomizer
@Bean @Order(5) public LoginChainCustomizer socialChainCustomizer(org.springframework.security.oauth2.client.registration.ClientRegistrationRepository repository, FederatedOidcUserService oidcService, FederatedOAuth2UserService oauth2Service, FactorGrantor grantor, FederatedFactorSelector selector, org.springframework.beans.factory.ObjectProvider<AppleClientSecretGenerator> apple, PendingIdentityLinks pendingIdentityLinks) Declares the customizer that enableshttp.oauth2Login(...). It is applied after the phone page one.- Parameters:
repository- registrations of the configured providers.oidcService- user service of the OpenID Connect providers.oauth2Service- user service of the OAuth 2.0 providers.grantor- adds the factor authority.selector- chooses the factor.apple- generates the Apple client secret; absent while Apple is not configured.pendingIdentityLinks- the link markers, which tell a link apart from a sign-in.- Returns:
- the customizer.
socialClientRegistrationRepository
properties- settings of the providers.mapper- maps the settings onto registrations.