Interface Authenticator
public interface Authenticator
The Authenticator interface represents an authentication mechanism or a group of similar authentication mechanisms.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThis class is a container to encapsulate the current request and other necessary information (mostly configuration related) required for authentication. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(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 theAuthenticator.Contextobject.default booleanWhether authentication with anonymous or fallback user is allowed after this authenticator.static org.elasticsearch.common.settings.SecureStringextractBearerTokenFromHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext) Gets the token from theAuthorizationheader if the header begins withBearerstatic org.elasticsearch.common.settings.SecureStringextractCredentialFromAuthorizationHeader(org.elasticsearch.common.util.concurrent.ThreadContext threadContext, String prefix) org.elasticsearch.xpack.core.security.authc.AuthenticationTokenextractCredentials(Authenticator.Context context) Attempt to Extract anAuthenticationTokenfrom the givenAuthenticator.Context.name()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 anAuthenticationTokenfrom the givenAuthenticator.Context.- Parameters:
context- The context object encapsulating current request and other information relevant for authentication.- Returns:
- An
AuthenticationTokenif 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 theAuthenticator.Contextobject.- Parameters:
context- The context object encapsulating current request and other information relevant for authentication.listener- The listener accepts aAuthenticationResultobject 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 theAuthorizationheader if the header begins withBearer
-