Class LoginController
java.lang.Object
com.irurueta.authserver.authorization.api.web.login.LoginController
- All Implemented Interfaces:
LoginPageApi
Serves the login page, as the contract
apis/auth-server/web-pages/auth-server-pages-v1.yaml describes it
through the generated LoginPageApi, supplying the ordered login method fragments and the outcome of the last
attempt to the template.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringName of the model attribute that holds the key of the message of a failed sign-in.private final LoginErrorMessagesMaps the last authentication exception to a message key.private final List<LoginMethodFragment> Fragments contributed by the authentication methods, sorted by order.(package private) static final StringName of the model attribute that holds the fragments of the login methods.(package private) static final StringName of the model attribute that tells the user has just signed out.static final StringPath of the login page, which also receives the form post.(package private) static final StringName of the model attribute that holds the path the login form posts to.private final PageRendererRenders the page.private final jakarta.servlet.http.HttpServletRequestThe current request, injected as a thread-bound proxy, whose session holds the last failure.(package private) static final StringName of the login template.Fields inherited from interface com.irurueta.authserver.authorization.api.web.pages.v1.generated.api.LoginPageApi
PATH_LOGIN_PAGE -
Constructor Summary
ConstructorsConstructorDescriptionLoginController(List<LoginMethodFragment> methods, LoginErrorMessages errorMessages, PageRenderer pageRenderer, jakarta.servlet.http.HttpServletRequest request) Creates the controller. -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.security.core.AuthenticationExceptionGets the exception of the previous failed attempt, which Spring Security keeps in the session.org.springframework.http.ResponseEntity<String> Renders the login page.
-
Field Details
-
LOGIN_PATH
Path of the login page, which also receives the form post. The single source of the path for the security chains and the template, taken from the contract.- See Also:
-
VIEW_NAME
Name of the login template.- See Also:
-
LOGIN_PATH_ATTRIBUTE
Name of the model attribute that holds the path the login form posts to.- See Also:
-
FRAGMENTS_ATTRIBUTE
Name of the model attribute that holds the fragments of the login methods.- See Also:
-
ERROR_MESSAGE_ATTRIBUTE
Name of the model attribute that holds the key of the message of a failed sign-in.- See Also:
-
LOGGED_OUT_ATTRIBUTE
Name of the model attribute that tells the user has just signed out.- See Also:
-
fragments
Fragments contributed by the authentication methods, sorted by order. -
errorMessages
Maps the last authentication exception to a message key. -
pageRenderer
Renders the page. -
request
private final jakarta.servlet.http.HttpServletRequest requestThe current request, injected as a thread-bound proxy, whose session holds the last failure.
-
-
Constructor Details
-
LoginController
public LoginController(List<LoginMethodFragment> methods, LoginErrorMessages errorMessages, PageRenderer pageRenderer, jakarta.servlet.http.HttpServletRequest request) Creates the controller.- Parameters:
methods- fragments contributed by the authentication methods.errorMessages- mapper of the authentication exceptions to message keys.pageRenderer- renderer of the page.request- the current request.
-
-
Method Details
-
loginPage
Renders the login page.- Specified by:
loginPagein interfaceLoginPageApi- Parameters:
error- present (even if empty) when the previous attempt failed.logout- present (even if empty) when the user has just signed out.- Returns:
- the login page.
-
lastFailure
private org.springframework.security.core.AuthenticationException lastFailure()Gets the exception of the previous failed attempt, which Spring Security keeps in the session.- Returns:
- the exception, or
nullwhen there is no session or it holds none.
-