Class AuthenticationResponse.Builder

java.lang.Object
io.helidon.security.AuthenticationResponse.Builder
All Implemented Interfaces:
Builder<AuthenticationResponse.Builder,AuthenticationResponse>, Supplier<AuthenticationResponse>
Enclosing class:
AuthenticationResponse

public static final class AuthenticationResponse.Builder extends Object
Authentication response builder. Allows fully customized response, if one of the static methods is not sufficient (e.g. when returning a specialized SecurityResponse.SecurityStatus.
  • Method Details

    • user

      public AuthenticationResponse.Builder user(Subject subject)
      Set the user subject as created by this provider.
      Parameters:
      subject - Subject to set for current request
      Returns:
      updated builder instance
    • service

      public AuthenticationResponse.Builder service(Subject subject)
      Set the service subject as created by this provider.
      Parameters:
      subject - Subject to set for current request
      Returns:
      updated builder instance
    • build

      public AuthenticationResponse build()
      Build authentication response.
      Returns:
      Response based on this builder
    • statusCode

      public AuthenticationResponse.Builder statusCode(int statusCode)
      Set a status code for failed statuses. This is expected to use HTTP status codes. If an integration is done with a non-http protocol, you must map these status codes appropriately.
      Parameters:
      statusCode - HTTP status code
      Returns:
      updated builder instance
    • status

      Set security status of this security response.
      Parameters:
      status - Status to set
      Returns:
      updated builder instance
    • description

      public AuthenticationResponse.Builder description(String description)
      Set description of this security response failure.
      Parameters:
      description - Description to provide to called in case of failed security, or null if no information can be provided
      Returns:
      updated builder instance
    • throwable

      public AuthenticationResponse.Builder throwable(Throwable exception)
      Set throwable causing failure of the security request.
      Parameters:
      exception - Exception that caused failure
      Returns:
      updated builder instance
    • requestHeaders

      public AuthenticationResponse.Builder requestHeaders(Map<String,List<String>> headers)
      Set additional/replacement headers for request.
      Parameters:
      headers - map with headers
      Returns:
      updated builder instance
    • requestHeader

      public AuthenticationResponse.Builder requestHeader(String header, String value)
      Add a single-value header. Note that if method requestHeaders(Map) is called after this method, it will remove changes by this method.
      Parameters:
      header - header name
      value - header value
      Returns:
      this instance
    • requestHeader

      public AuthenticationResponse.Builder requestHeader(String header, List<String> values)
      Add a multi-value header. Note that if method requestHeaders(Map) is called after this method, it may remove changes by this method.
      Parameters:
      header - header name
      values - header values
      Returns:
      this instance
    • responseHeaders

      public AuthenticationResponse.Builder responseHeaders(Map<String,List<String>> headers)
      Set additional/replacement headers for request.
      Parameters:
      headers - map with headers
      Returns:
      updated builder instance
    • responseHeader

      public AuthenticationResponse.Builder responseHeader(String header, String value)
      Add a single-value header. Note that if method responseHeaders(Map) is called after this method, it will remove changes by this method.
      Parameters:
      header - header name
      value - header value
      Returns:
      this instance
    • responseHeader

      public AuthenticationResponse.Builder responseHeader(String header, List<String> values)
      Add a multi-value header. Note that if method responseHeaders(Map) is called after this method, it may remove changes by this method.
      Parameters:
      header - header name
      values - header values
      Returns:
      this instance