Package com.floragunn.searchguard.auth
Interface HTTPAuthenticator
-
- All Known Implementing Classes:
HTTPBasicAuthenticator,HTTPClientCertAuthenticator,HTTPProxyAuthenticator,HTTPProxyAuthenticator2
public interface HTTPAuthenticatorSearch Guard custom HTTP authenticators need to implement this interface. A HTTP authenticator extractsAuthCredentialsfrom aRestRequestImplementation classes must provide a public constructorpublic MyHTTPAuthenticator(org.elasticsearch.common.settings.Settings settings, java.nio.file.Path configPath)The constructor should not throw any exception in case of an initialization problem. Instead catch all exceptions and log a appropriate error message. A logger can be instantiated like:private final Logger log = LogManager.getLogger(this.getClass());Custom authenticators is a commercial feature. To make them work you need to obtain a license here: https://floragunn.com
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AuthCredentialsextractCredentials(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.util.concurrent.ThreadContext context)ExtractAuthCredentialsfromRestRequestStringgetType()The type (name) of the authenticator.booleanreRequestAuthentication(org.elasticsearch.rest.RestChannel channel, AuthCredentials credentials)If theextractCredentials()call was not successful or the authentication flow needs another roundtrip this method will be called.
-
-
-
Method Detail
-
getType
String getType()
The type (name) of the authenticator. Only for logging.- Returns:
- the type
-
extractCredentials
AuthCredentials extractCredentials(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.util.concurrent.ThreadContext context) throws org.elasticsearch.ElasticsearchSecurityException
ExtractAuthCredentialsfromRestRequest- Parameters:
request- The rest requestcontext- The current thread context- Returns:
- The authentication credentials (complete or incomplete) or null when no credentials are found in the request
When the credentials could be fully extracted from the request
.markComplete()must be called on theAuthCredentialswhich are returned. If the authentication flow needs another roundtrip with the request originator do not mark it as complete. - Throws:
org.elasticsearch.ElasticsearchSecurityException
-
reRequestAuthentication
boolean reRequestAuthentication(org.elasticsearch.rest.RestChannel channel, AuthCredentials credentials)If theextractCredentials()call was not successful or the authentication flow needs another roundtrip this method will be called. If the custom HTTP authenticator does not support this method is a no-op and false should be returned. If the custom HTTP authenticator does support re-request authentication or supports authentication flows with multiple roundtrips then the response should be sent (through the channel) and true must be returned.- Parameters:
channel- The rest channel to sent back the response viachannel.sendResponse()credentials- The credentials from the prior authentication attempt- Returns:
- false if re-request is not supported/necessary, true otherwise.
If true is returned
channel.sendResponse()must be called so that the request completes.
-
-