java.lang.Object
io.goobi.viewer.model.security.authentication.LoginResult

public class LoginResult extends Object
Encapsulates the outcome of an authentication attempt, including the authenticated user and any error message.
Author:
Florian Alpers
  • 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 attempt
      response - HTTP response associated with the login attempt
      user - optional containing the authenticated user, or empty if login failed
      loginRefused - 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 attempt
      response - HTTP response associated with the login attempt
      user - optional containing the authenticated user, or empty if login failed
      loginRefused - true if the login has been refused even if the user may exist and be valid. Typically true for wrong password
      delay - 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 attempt
      response - HTTP response associated with the login attempt
      exception - 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 attempt
      response - HTTP response associated with the login attempt
      exception - exception that caused the login failure
      delay - configured delay in milliseconds before completing the result
  • Method Details

    • getRequest

      public HttpServletRequest getRequest()
      Getter for the field request.
      Returns:
      the HTTP request associated with this login attempt
    • getResponse

      public HttpServletResponse getResponse()
      Getter for the field response.
      Returns:
      the HTTP response associated with this login attempt
    • getUser

      public Optional<User> getUser() throws AuthenticationProviderException
      Getter for the field user.
      Returns:
      the user Optional containing the user if login was successful. Otherwise an empty optional
      Throws:
      AuthenticationProviderException - if any.
    • isRedirected

      public Future<Boolean> isRedirected(long timeout)
      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()