Class Authenticator.Context

java.lang.Object
org.elasticsearch.xpack.security.authc.Authenticator.Context
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing interface:
Authenticator

public static class Authenticator.Context extends Object implements Closeable
This class is a container to encapsulate the current request and other necessary information (mostly configuration related) required for authentication. It is instantiated for every incoming request and passed around to AuthenticatorChain and subsequently all Authenticator. Authenticators are consulted in order (see AuthenticatorChain), where each is given the chance to first extract some token, and then to verify it. If token verification fails in some particular way (i.e. AuthenticationResult.Status.CONTINUE), the next Authenticator is tried. The extracted tokens are all appended with addAuthenticationToken(AuthenticationToken).
  • Constructor Details

  • Method Details

    • getThreadContext

      public ThreadContext getThreadContext()
    • getRequest

    • getFallbackUser

      public User getFallbackUser()
    • isAllowAnonymous

      public boolean isAllowAnonymous()
    • setHandleNullToken

      public void setHandleNullToken(boolean value)
    • shouldHandleNullToken

      public boolean shouldHandleNullToken()
    • shouldExtractCredentials

      public boolean shouldExtractCredentials()
      Returns true, if Authenticators should first be tried in order to extract the credentials token from the thread context. The extracted tokens are appended to this authenticator context with addAuthenticationToken(AuthenticationToken). If false, the credentials token is directly passed in to this authenticator context, and the authenticators themselves are only consulted to authenticate the token, and never to extract any tokens from the thread context.
    • getUnsuccessfulMessages

      public List<String> getUnsuccessfulMessages()
    • addAuthenticationToken

      public void addAuthenticationToken(AuthenticationToken authenticationToken)
    • getMostRecentAuthenticationToken

      @Nullable public AuthenticationToken getMostRecentAuthenticationToken()
    • getBearerString

      public SecureString getBearerString()
    • getApiKeyString

      public SecureString getApiKeyString()
    • getDefaultOrderedRealmList

      public List<Realm> getDefaultOrderedRealmList()
    • getUnlicensedRealms

      public List<Realm> getUnlicensedRealms()
    • addUnsuccessfulMessage

      public void addUnsuccessfulMessage(String message)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • addUnsuccessfulMessageToMetadata

      public void addUnsuccessfulMessageToMetadata(ElasticsearchSecurityException ese)