Package com.floragunn.searchguard.http
Class HTTPBasicAuthenticator
- java.lang.Object
-
- com.floragunn.searchguard.http.HTTPBasicAuthenticator
-
- All Implemented Interfaces:
HTTPAuthenticator
public class HTTPBasicAuthenticator extends Object implements HTTPAuthenticator
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description HTTPBasicAuthenticator(org.elasticsearch.common.settings.Settings settings, Path configPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthCredentialsextractCredentials(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.util.concurrent.ThreadContext threadContext)ExtractAuthCredentialsfromRestRequestStringgetType()The type (name) of the authenticator.booleanreRequestAuthentication(org.elasticsearch.rest.RestChannel channel, AuthCredentials creds)If theextractCredentials()call was not successful or the authentication flow needs another roundtrip this method will be called.
-
-
-
Constructor Detail
-
HTTPBasicAuthenticator
public HTTPBasicAuthenticator(org.elasticsearch.common.settings.Settings settings, Path configPath)
-
-
Method Detail
-
extractCredentials
public AuthCredentials extractCredentials(org.elasticsearch.rest.RestRequest request, org.elasticsearch.common.util.concurrent.ThreadContext threadContext)
Description copied from interface:HTTPAuthenticatorExtractAuthCredentialsfromRestRequest- Specified by:
extractCredentialsin interfaceHTTPAuthenticator- Parameters:
request- The rest requestthreadContext- 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.
-
reRequestAuthentication
public boolean reRequestAuthentication(org.elasticsearch.rest.RestChannel channel, AuthCredentials creds)Description copied from interface:HTTPAuthenticatorIf 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.- Specified by:
reRequestAuthenticationin interfaceHTTPAuthenticator- Parameters:
channel- The rest channel to sent back the response viachannel.sendResponse()creds- 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.
-
getType
public String getType()
Description copied from interface:HTTPAuthenticatorThe type (name) of the authenticator. Only for logging.- Specified by:
getTypein interfaceHTTPAuthenticator- Returns:
- the type
-
-