Class FederatedAccountResolver
The use case finds, links or provisions the account and refuses a disabled one before it links anything; the
account is then loaded through the status-checking user service as well (the rules of
AccountStatusUserDetailsService: a disabled, locked or expired account is refused, exactly as the password
and passkey sign-ins refuse it). Every refusal is the same access_denied error, which the login chain turns
into the generic failure of the login page, so the answer never says whether an account exists or why it was
refused.
When the signed-in user asked to link this provider (PendingIdentityLinks), the identity is linked to
that account through LinkIdentityUseCase instead: nothing is resolved by e-mail address or provisioned, and
an identity that belongs to another account is refused with LINK_REFUSED, which the failure handler sends
back to the identities page.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.core.userdetails.UserDetailsServiceLoads the account, refusing one that may not sign in.static final StringError code of a refused link: the identity belongs to another account.(package private) static final StringError description of a refused link.private final LinkIdentityUseCaseUse case that links an identity to the signed-in account.private final PendingIdentityLinksThe link markers of the explicit link flow.(package private) static final StringError description of every refusal.private final ResolveFederatedLoginUseCaseUse case that finds, links or provisions the account. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.security.core.userdetails.UserDetailslink(PendingIdentityLink link, IdentityProvider provider, String subject, String email) Links an identity to the signed-in account that asked for it.org.springframework.security.core.userdetails.UserDetailsresolve(IdentityProvider provider, String subject, String email, boolean emailVerified) Resolves a sign-in.
-
Field Details
-
REFUSED
Error description of every refusal.- See Also:
-
LINK_REFUSED
Error code of a refused link: the identity belongs to another account.- See Also:
-
LINK_REFUSED_DESCRIPTION
Error description of a refused link.- See Also:
-
resolveFederatedLoginUseCase
Use case that finds, links or provisions the account. -
accountStatusUserDetailsService
private final org.springframework.security.core.userdetails.UserDetailsService accountStatusUserDetailsServiceLoads the account, refusing one that may not sign in. -
linkIdentityUseCase
Use case that links an identity to the signed-in account. -
pendingIdentityLinks
The link markers of the explicit link flow.
-
-
Constructor Details
-
FederatedAccountResolver
public FederatedAccountResolver()
-
-
Method Details
-
resolve
public org.springframework.security.core.userdetails.UserDetails resolve(IdentityProvider provider, String subject, String email, boolean emailVerified) Resolves a sign-in.- Parameters:
provider- the provider that authenticated the user.subject- the provider's stable identifier of the user.email- e-mail address the provider reported, ornull.emailVerified- whether the provider vouches for the address.- Returns:
- the local account, which may sign in; for a link, the signed-in account.
- Throws:
org.springframework.security.oauth2.core.OAuth2AuthenticationException- if the sign-in is refused: the provider did not verify the address, the address belongs to an unverified account, or the account is disabled, locked or expired; or if a link is refused because the identity belongs to another account.
-
link
private org.springframework.security.core.userdetails.UserDetails link(PendingIdentityLink link, IdentityProvider provider, String subject, String email) Links an identity to the signed-in account that asked for it.- Parameters:
link- the link marker.provider- the provider that authenticated the user.subject- the provider's stable identifier of the user.email- e-mail address the provider reported, ornull.- Returns:
- the signed-in account.
- Throws:
org.springframework.security.oauth2.core.OAuth2AuthenticationException- if the identity belongs to another account, or the account may no longer sign in.
-