Class AbstractAuthenticationController<T extends UserRedirectAuthenticationProvider>
java.lang.Object
se.swedenconnect.spring.saml.idp.authentication.provider.external.AbstractAuthenticationController<T>
- Type Parameters:
T- the type of the authentication provider
public abstract class AbstractAuthenticationController<T extends UserRedirectAuthenticationProvider>
extends Object
A helper class that
Controllers that implement "external user authentication" may inherit from.- Author:
- Martin Lindström
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelAndViewcancel(jakarta.servlet.http.HttpServletRequest request) Maps tocomplete(request, new Saml2ErrorStatusException(Saml2ErrorStatus.CANCEL)).protected ModelAndViewcomplete(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.core.Authentication authentication) Utility method that saves the authentication result in theExternalAuthenticatorTokenRepositoryof the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()).protected ModelAndViewcomplete(jakarta.servlet.http.HttpServletRequest request, Saml2ErrorStatusException error) Utility method that saves the authentication error in theExternalAuthenticatorTokenRepositoryof the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()).protected RedirectForAuthenticationTokengetInputToken(jakarta.servlet.http.HttpServletRequest request) Gets theRedirectForAuthenticationTokenthat is the input for the "external authentication" process.protected abstract TGets theUserRedirectAuthenticationProviderfor this type of user authentication.
-
Constructor Details
-
AbstractAuthenticationController
public AbstractAuthenticationController()
-
-
Method Details
-
getInputToken
protected RedirectForAuthenticationToken getInputToken(jakarta.servlet.http.HttpServletRequest request) throws UnrecoverableSaml2IdpException Gets theRedirectForAuthenticationTokenthat is the input for the "external authentication" process.- Parameters:
request- the HTTP servlet request- Returns:
- a
RedirectForAuthenticationToken - Throws:
UnrecoverableSaml2IdpException- if no token is available
-
complete
protected ModelAndView complete(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.core.Authentication authentication) Utility method that saves the authentication result in theExternalAuthenticatorTokenRepositoryof the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()).- Parameters:
request- the HTTP servlet requestauthentication- the authentication object- Returns:
- a
ModelAndViewthat redirects the user back to the configured resume path
-
complete
protected ModelAndView complete(jakarta.servlet.http.HttpServletRequest request, Saml2ErrorStatusException error) Utility method that saves the authentication error in theExternalAuthenticatorTokenRepositoryof the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()).- Parameters:
request- the HTTP servlet requesterror- the authentication error- Returns:
- a
ModelAndViewthat redirects the user back to the configured resume path
-
cancel
Maps tocomplete(request, new Saml2ErrorStatusException(Saml2ErrorStatus.CANCEL)).- Parameters:
request- the HTTP servlet request- Returns:
- a
ModelAndViewthat redirects the user back to the configured resume path
-
getProvider
Gets theUserRedirectAuthenticationProviderfor this type of user authentication.- Returns:
- the user authentication provider
-