Class HttpAuthenticator.Builder

  • Enclosing class:
    HttpAuthenticator

    public static class HttpAuthenticator.Builder
    extends Object
    A Builder to configure and create an instance of HttpAuthenticator.
    • Constructor Detail

      • Builder

        Builder()
    • Method Detail

      • setRequired

        public HttpAuthenticator.Builder setRequired​(boolean required)
        Sets if authentication is required for the current request, if not required mechanisms will be called to be given the opportunity to authenticate
        Parameters:
        required - is authentication required for the current request?
        Returns:
        the HttpAuthenticator.Builder to allow method call chaining.
      • setIgnoreOptionalFailures

        public HttpAuthenticator.Builder setIgnoreOptionalFailures​(boolean ignoreOptionalFailures)
        Where authentication is not required but is still attempted a failure of an authentication mechanism will cause the challenges to be sent and the current request returned to the client, setting this value to true will allow the failure to be ignored. This setting has no effect when required is set to true, in that case all failures will result in a client
        Parameters:
        ignoreOptionalFailures - should mechanism failures be ignored if authentication is optional.
        Returns:
        the HttpAuthenticator.Builder to allow method call chaining.
      • registerLogoutHandler

        public HttpAuthenticator.Builder registerLogoutHandler​(Consumer<Runnable> logoutHandlerConsumer)

        A Consumer responsible for registering a Runnable emitted by one of the mechanisms during the evaluation of a request and representing some action to be taken during logout.

        This method is mainly targeted for programmatic logout where logout requests are send by the application after the authentication. Although, integration code is free to register the logout handler whatever they want in order to support different logout scenarios.

        Parameters:
        logoutHandlerConsumer - the consumer responsible for registering the logout handler (not null)
        Returns:
        the HttpAuthenticator.Builder to allow method call chaining.
      • setProgrammaticMechanismName

        public HttpAuthenticator.Builder setProgrammaticMechanismName​(String programmaticMechanismName)
        Set the mechanism name that should be used for programmatic authentication if one is not provided at the time of the call.
        Parameters:
        programmaticMechanismName - the name of the mechanism to use for programmatic authentication.
        Returns:
        the HttpAuthenticator.Builder to allow method call chaining.
      • build

        public HttpAuthenticator build()
        Build the new HttpAuthenticator instance.
        Returns:
        the new HttpAuthenticator instance.