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
Controller
s that implement "external user authentication" may inherit from.- Author:
- Martin Lindström
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ModelAndView
cancel
(jakarta.servlet.http.HttpServletRequest request) Maps tocomplete(request, new Saml2ErrorStatusException(Saml2ErrorStatus.CANCEL))
.protected ModelAndView
complete
(jakarta.servlet.http.HttpServletRequest request, org.springframework.security.core.Authentication authentication) Utility method that saves the authentication result in theExternalAuthenticatorTokenRepository
of the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()
).protected ModelAndView
complete
(jakarta.servlet.http.HttpServletRequest request, Saml2ErrorStatusException error) Utility method that saves the authentication error in theExternalAuthenticatorTokenRepository
of the provider and redirects the user back to the SAML IdP Spring Security flow (UserRedirectAuthenticationProvider.getResumeAuthnPath()
).protected RedirectForAuthenticationToken
getInputToken
(jakarta.servlet.http.HttpServletRequest request) Gets theRedirectForAuthenticationToken
that is the input for the "external authentication" process.protected abstract T
Gets theUserRedirectAuthenticationProvider
for this type of user authentication.
-
Constructor Details
-
AbstractAuthenticationController
public AbstractAuthenticationController()
-
-
Method Details
-
getInputToken
protected RedirectForAuthenticationToken getInputToken(jakarta.servlet.http.HttpServletRequest request) throws UnrecoverableSaml2IdpException Gets theRedirectForAuthenticationToken
that 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 theExternalAuthenticatorTokenRepository
of 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
ModelAndView
that 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 theExternalAuthenticatorTokenRepository
of 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
ModelAndView
that 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
ModelAndView
that redirects the user back to the configured resume path
-
getProvider
Gets theUserRedirectAuthenticationProvider
for this type of user authentication.- Returns:
- the user authentication provider
-