Class FederatedAuthenticationSuccessHandler
java.lang.Object
com.irurueta.authserver.authorization.api.web.social.FederatedAuthenticationSuccessHandler
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationSuccessHandler
public class FederatedAuthenticationSuccessHandler
extends Object
implements org.springframework.security.web.authentication.AuthenticationSuccessHandler
Success handler of the sign-in with an external provider. The framework's authentication carries no factor
authority, so this handler grants the federated factor through
FactorGrantor (the strong one when the
provider is trusted, see FederatedFactorSelector), makes the result the current authentication, saves the
security context again (the filter saved the first one before calling the handler), and then lets the usual handler
resume the saved request, for example the /oauth2/authorize that sent the user to the login page.
When the answer of the provider completed a link (PendingIdentityLinks.linkedBy(jakarta.servlet.http.HttpServletRequest)), nobody signs in: the
authentication the session had before is put back and saved, no factor is granted, and the browser returns to the
identities page with the status linked.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.security.web.authentication.AuthenticationSuccessHandlerThe handler that resumes the saved request.private final FactorGrantorAdds the factor authority.private final FederatedFactorSelectorChooses the factor.private final org.springframework.security.core.context.SecurityContextHolderStrategyHolder of the security context of the thread.(package private) static final StringQuery of the identities page after a link.private final PendingIdentityLinksThe link markers of the explicit link flow.private final org.springframework.security.web.context.SecurityContextRepositorySaves the security context, the same repository the sign-in filter uses. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonAuthenticationSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication) Grants the factor and continues.private voidsave(org.springframework.security.core.Authentication authentication, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Makes an authentication the current one and saves it in the session.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.web.authentication.AuthenticationSuccessHandler
onAuthenticationSuccess
-
Field Details
-
LINKED_STATUS
Query of the identities page after a link.- See Also:
-
factorGrantor
Adds the factor authority. -
factorSelector
Chooses the factor. -
securityContextRepository
private final org.springframework.security.web.context.SecurityContextRepository securityContextRepositorySaves the security context, the same repository the sign-in filter uses. -
delegate
private final org.springframework.security.web.authentication.AuthenticationSuccessHandler delegateThe handler that resumes the saved request. -
pendingIdentityLinks
The link markers of the explicit link flow. -
holderStrategy
private final org.springframework.security.core.context.SecurityContextHolderStrategy holderStrategyHolder of the security context of the thread.
-
-
Constructor Details
-
FederatedAuthenticationSuccessHandler
public FederatedAuthenticationSuccessHandler()
-
-
Method Details
-
onAuthenticationSuccess
public void onAuthenticationSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication) throws IOException, jakarta.servlet.ServletException Grants the factor and continues.- Specified by:
onAuthenticationSuccessin interfaceorg.springframework.security.web.authentication.AuthenticationSuccessHandler- Parameters:
request- the request.response- the response.authentication- the authentication of the sign-in.- Throws:
IOException- if the redirect fails.jakarta.servlet.ServletException- if the redirect fails.
-
save
private void save(org.springframework.security.core.Authentication authentication, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Makes an authentication the current one and saves it in the session.- Parameters:
authentication- the authentication.request- the request.response- the response.
-