Interface Authenticator


public interface Authenticator
The Authenticator interface represents an authentication mechanism or a group of similar authentication mechanisms.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    This class is a container to encapsulate the current request and other necessary information (mostly configuration related) required for authentication.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    authenticate(Authenticator.Context context, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.authc.Authentication>> listener)
    Attempt to authenticate current request encapsulated by the Authenticator.Context object.
    default boolean
    Whether authentication with anonymous or fallback user is allowed after this authenticator.
    static org.elasticsearch.common.settings.SecureString
    extractBearerTokenFromHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
    Gets the token from the Authorization header if the header begins with Bearer
    static org.elasticsearch.common.settings.SecureString
    extractCredentialFromAuthorizationHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext, String prefix)
     
    org.elasticsearch.xpack.core.security.authc.AuthenticationToken
    Attempt to Extract an AuthenticationToken from the given Authenticator.Context.
    A descriptive name of the authenticator.
  • Method Details

    • name

      String name()
      A descriptive name of the authenticator.
    • extractCredentials

      @Nullable org.elasticsearch.xpack.core.security.authc.AuthenticationToken extractCredentials(Authenticator.Context context)
      Attempt to Extract an AuthenticationToken from the given Authenticator.Context.
      Parameters:
      context - The context object encapsulating current request and other information relevant for authentication.
      Returns:
      An AuthenticationToken if one can be extracted or null if this Authenticator cannot extract one.
    • canBeFollowedByNullTokenHandler

      default boolean canBeFollowedByNullTokenHandler()
      Whether authentication with anonymous or fallback user is allowed after this authenticator.
    • authenticate

      void authenticate(Authenticator.Context context, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.AuthenticationResult<org.elasticsearch.xpack.core.security.authc.Authentication>> listener)
      Attempt to authenticate current request encapsulated by the Authenticator.Context object.
      Parameters:
      context - The context object encapsulating current request and other information relevant for authentication.
      listener - The listener accepts a AuthenticationResult object indicating the outcome of authentication.
    • extractCredentialFromAuthorizationHeader

      static org.elasticsearch.common.settings.SecureString extractCredentialFromAuthorizationHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext, String prefix)
    • extractBearerTokenFromHeader

      static org.elasticsearch.common.settings.SecureString extractBearerTokenFromHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
      Gets the token from the Authorization header if the header begins with Bearer