Class LoginResult
java.lang.Object
io.goobi.viewer.model.security.authentication.LoginResult
Encapsulates the outcome of an authentication attempt, including the authenticated user and any error message.
- Author:
- Florian Alpers
-
Constructor Summary
ConstructorsConstructorDescriptionLoginResult(HttpServletRequest request, HttpServletResponse response, AuthenticationProviderException exception) Creates a new LoginResult instance.LoginResult(HttpServletRequest request, HttpServletResponse response, AuthenticationProviderException exception, long delay) Creates a new LoginResult instance.LoginResult(HttpServletRequest request, HttpServletResponse response, Optional<User> user, boolean loginRefused) Creates a new LoginResult instance.LoginResult(HttpServletRequest request, HttpServletResponse response, Optional<User> user, boolean loginRefused, long delay) Creates a new LoginResult instance. -
Method Summary
Modifier and TypeMethodDescriptionlonggetDelay()Getter for the fieldrequest.Getter for the fieldresponse.getUser()Getter for the fielduser.isRedirected(long timeout) isRedirected.booleanisRefused.voidsetRedirected.
-
Constructor Details
-
LoginResult
public LoginResult(HttpServletRequest request, HttpServletResponse response, Optional<User> user, boolean loginRefused) Creates a new LoginResult instance.- Parameters:
request- HTTP request associated with the login attemptresponse- HTTP response associated with the login attemptuser- optional containing the authenticated user, or empty if login failedloginRefused- true if the login has been refused even if the user may exist and be valid. Typically true for wrong password
-
LoginResult
public LoginResult(HttpServletRequest request, HttpServletResponse response, Optional<User> user, boolean loginRefused, long delay) Creates a new LoginResult instance.- Parameters:
request- HTTP request associated with the login attemptresponse- HTTP response associated with the login attemptuser- optional containing the authenticated user, or empty if login failedloginRefused- true if the login has been refused even if the user may exist and be valid. Typically true for wrong passworddelay- configured delay in milliseconds before completing the result
-
LoginResult
public LoginResult(HttpServletRequest request, HttpServletResponse response, AuthenticationProviderException exception) Creates a new LoginResult instance.- Parameters:
request- HTTP request associated with the login attemptresponse- HTTP response associated with the login attemptexception- exception that caused the login failure
-
LoginResult
public LoginResult(HttpServletRequest request, HttpServletResponse response, AuthenticationProviderException exception, long delay) Creates a new LoginResult instance.- Parameters:
request- HTTP request associated with the login attemptresponse- HTTP response associated with the login attemptexception- exception that caused the login failuredelay- configured delay in milliseconds before completing the result
-
-
Method Details
-
getRequest
Getter for the fieldrequest.- Returns:
- the HTTP request associated with this login attempt
-
getResponse
Getter for the fieldresponse.- Returns:
- the HTTP response associated with this login attempt
-
getUser
Getter for the fielduser.- Returns:
- the user Optional containing the user if login was successful. Otherwise an empty optional
- Throws:
AuthenticationProviderException- if any.
-
isRedirected
isRedirected.- Parameters:
timeout- maximum wait time in milliseconds for the redirect signal- Returns:
- a Future resolving to true once a redirect has been signaled
-
setRedirected
public void setRedirected()setRedirected. -
isRefused
public boolean isRefused()isRefused.- Returns:
- true if the login attempt was explicitly refused, false otherwise
-
getDelay
public long getDelay()
-