Class SecondaryAuthenticator

java.lang.Object
org.elasticsearch.xpack.security.authc.support.SecondaryAuthenticator

public class SecondaryAuthenticator extends Object
Performs "secondary user authentication" (that is, a second user, _not_ second factor authentication).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The term "Authorization" in the header value is to mimic the standard HTTP "Authorization" header
  • Constructor Summary

    Constructors
    Constructor
    Description
    SecondaryAuthenticator(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.common.util.concurrent.ThreadContext threadContext, AuthenticationService authenticationService)
     
    SecondaryAuthenticator(org.elasticsearch.xpack.core.security.SecurityContext securityContext, AuthenticationService authenticationService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    authenticate(String action, org.elasticsearch.transport.TransportRequest request, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.support.SecondaryAuthentication> listener)
     
    void
    authenticateAndAttachToContext(org.elasticsearch.rest.RestRequest request, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.support.SecondaryAuthentication> listener)
     
    boolean
    Checks whether this thread context provides secondary authentication credentials.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SECONDARY_AUTH_HEADER_NAME

      public static final String SECONDARY_AUTH_HEADER_NAME
      The term "Authorization" in the header value is to mimic the standard HTTP "Authorization" header
      See Also:
  • Constructor Details

    • SecondaryAuthenticator

      public SecondaryAuthenticator(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.common.util.concurrent.ThreadContext threadContext, AuthenticationService authenticationService)
    • SecondaryAuthenticator

      public SecondaryAuthenticator(org.elasticsearch.xpack.core.security.SecurityContext securityContext, AuthenticationService authenticationService)
  • Method Details

    • authenticate

      public void authenticate(String action, org.elasticsearch.transport.TransportRequest request, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.support.SecondaryAuthentication> listener)
      Parameters:
      listener - Handler for the SecondaryAuthentication object. If the secondary authentication credentials do not exist the thread context, the ActionListener.onResponse(Object) method is called with a null authentication value. If the secondary authentication credentials are found in the thread context, but fail to be authenticated, then the failure is returned through ActionListener.onFailure(Exception).
    • authenticateAndAttachToContext

      public void authenticateAndAttachToContext(org.elasticsearch.rest.RestRequest request, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.support.SecondaryAuthentication> listener)
      Parameters:
      listener - Handler for the SecondaryAuthentication object. If the secondary authentication credentials do not exist the thread context, the ActionListener.onResponse(Object) method is called with a null authentication value. If the secondary authentication credentials are found in the thread context, but fail to be authenticated, then the failure is returned through ActionListener.onFailure(Exception).
    • hasSecondaryAuthenticationHeader

      public boolean hasSecondaryAuthenticationHeader()
      Checks whether this thread context provides secondary authentication credentials. This does not check whether the header contains valid credentials - you must call authenticateAndAttachToContext(org.elasticsearch.rest.RestRequest, org.elasticsearch.action.ActionListener<org.elasticsearch.xpack.core.security.authc.support.SecondaryAuthentication>) to validate the header.
      Returns:
      true if a secondary authentication header exists in the thread context.