Class AuthenticationResponse

java.lang.Object
io.helidon.security.SecurityResponse
io.helidon.security.AuthenticationResponse

public final class AuthenticationResponse extends SecurityResponse
Response as returned from an authentication provider. Provider should return a response even for failed authentications. Only throw an exception if an error has occurred (e.g. misconfiguration). Do not throw exception for bad credentials...
See Also:
  • Method Details

    • builder

      public static AuthenticationResponse.Builder builder()
      Get a builder for more complex responses.
      Returns:
      Builder instance
    • failed

      public static AuthenticationResponse failed(String message, Throwable cause)
      Construct a failed response with a throwable as a cause.
      Parameters:
      message - Descriptive message of what happened. This message is propagated to public API!
      cause - Throwable causing the failed authentication. This will be logged. It may reach user only in case of debug.
      Returns:
      AuthenticationResponse with information filled
    • failed

      public static AuthenticationResponse failed(String message)
      Construct a failed response with an explanatory message.
      Parameters:
      message - Descriptive message of what happened. This message is propagated to public API!
      Returns:
      AuthenticationResponse with information filled
    • abstain

      public static AuthenticationResponse abstain()
      Provider returning this response is not capable to make a decision (e.g. the user format is not supported).
      Returns:
      AuthenticationResponse with information filled
    • success

      public static AuthenticationResponse success(Subject subject)
      Provider has authenticated the request and created a user Subject.
      Parameters:
      subject - Subject of the current user
      Returns:
      AuthenticationResponse with information filled
    • success

      public static AuthenticationResponse success(Subject user, Subject service)
      Provider has authenticated the request and created a user and service Subject.
      Parameters:
      user - Subject of the current user
      service - Subject of the current service
      Returns:
      AuthenticationResponse with information filled
    • successService

      public static AuthenticationResponse successService(Subject service)
      Provider has authenticated the request and created a service Subject.
      Parameters:
      service - Subject of requesting service (or client)
      Returns:
      AuthenticationResponse with information filled
    • success

      public static AuthenticationResponse success(Principal principal)
      Provider has authenticated the request and created a principal for a user.
      Parameters:
      principal - principal of the user
      Returns:
      AuthenticationResponse with information filled
      See Also:
    • successService

      public static AuthenticationResponse successService(Principal principal)
      Provider has authenticated the request and created a principal for a service (or a client).
      Parameters:
      principal - principal of the service
      Returns:
      AuthenticationResponse with information filled
      See Also:
    • user

      public Optional<Subject> user()
      User subject.
      Returns:
      Subject of the user, if one was authenticated
    • service

      public Optional<Subject> service()
      Service (or client) subject.
      Returns:
      Subject of the service (or client), if one was authenticated
    • toString

      public String toString()
      Overrides:
      toString in class SecurityResponse