Module org.elasticsearch.security
Interface Authenticator
- All Known Implementing Classes:
PluggableApiKeyAuthenticator,RealmsAuthenticator
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, ActionListener<AuthenticationResult<Authentication>> listener) Attempt to authenticate current request encapsulated by theAuthenticator.Contextobject.static SecureStringextractApiKeyFromHeader(ThreadContext threadContext) static SecureStringextractBearerTokenFromHeader(ThreadContext threadContext) Gets the token from theAuthorizationheader if the header begins withBearerstatic SecureStringextractCredentialFromAuthorizationHeader(ThreadContext threadContext, String prefix) static SecureStringextractCredentialFromHeaderValue(String header, String prefix) extractCredentials(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
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.
-
authenticate
void authenticate(Authenticator.Context context, ActionListener<AuthenticationResult<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 SecureString extractCredentialFromAuthorizationHeader(ThreadContext threadContext, String prefix) -
extractCredentialFromHeaderValue
-
extractBearerTokenFromHeader
Gets the token from theAuthorizationheader if the header begins withBearer -
extractApiKeyFromHeader
-