Class MultiSchemeAuthenticationHandler
- All Implemented Interfaces:
AuthenticationHandler,CompositeAuthenticationHandler
MultiSchemeAuthenticationHandler supports configuring multiple
authentication mechanisms simultaneously. e.g. server can support multiple
authentication mechanisms such as Kerberos (SPENGO) and LDAP. During the
authentication phase, server will specify all possible authentication schemes
and let client choose the appropriate scheme. Please refer to RFC-2616 and
HADOOP-12082 for more details.
The supported configuration properties are:
- multi-scheme-auth-handler.schemes: A comma separated list of HTTP authentication mechanisms supported by this handler. It does not have a default value. e.g. multi-scheme-auth-handler.schemes=basic,negotiate
- multi-scheme-auth-handler.schemes.${scheme-name}.handler: The authentication handler implementation to be used for the specified authentication scheme. It does not have a default value. e.g. multi-scheme-auth-handler.schemes.negotiate.handler=kerberos
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final StringConstant that identifies the authentication mechanism.Fields inherited from interface org.apache.hadoop.security.authentication.server.AuthenticationHandler
WWW_AUTHENTICATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs an authentication step for the given HTTP client request.voiddestroy()Destroys the authentication handler instance.This method returns the token types supported by this authentication handler.getType()Returns the authentication type of the authentication handler.voidinit(Properties config) Initializes the authentication handler instance.protected AuthenticationHandlerinitializeAuthHandler(String authHandlerClassName, Properties config) booleanmanagementOperation(AuthenticationToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Performs an authentication management operation.
-
Field Details
-
SCHEMES_PROPERTY
- See Also:
-
AUTH_HANDLER_PROPERTY
- See Also:
-
TYPE
Constant that identifies the authentication mechanism.- See Also:
-
-
Constructor Details
-
MultiSchemeAuthenticationHandler
public MultiSchemeAuthenticationHandler() -
MultiSchemeAuthenticationHandler
-
-
Method Details
-
getType
Description copied from interface:AuthenticationHandlerReturns the authentication type of the authentication handler. This should be a name that uniquely identifies the authentication type. For example 'simple' or 'kerberos'.- Specified by:
getTypein interfaceAuthenticationHandler- Returns:
- the authentication type of the authentication handler.
-
getTokenTypes
This method returns the token types supported by this authentication handler.- Specified by:
getTokenTypesin interfaceCompositeAuthenticationHandler- Returns:
- the token types supported by this authentication handler.
-
init
Description copied from interface:AuthenticationHandlerInitializes the authentication handler instance.This method is invoked by the
AuthenticationFilter.init(javax.servlet.FilterConfig)method.- Specified by:
initin interfaceAuthenticationHandler- Parameters:
config- configuration properties to initialize the handler.- Throws:
javax.servlet.ServletException- thrown if the handler could not be initialized.
-
initializeAuthHandler
protected AuthenticationHandler initializeAuthHandler(String authHandlerClassName, Properties config) throws javax.servlet.ServletException - Throws:
javax.servlet.ServletException
-
destroy
public void destroy()Description copied from interface:AuthenticationHandlerDestroys the authentication handler instance.This method is invoked by the
AuthenticationFilter.destroy()method.- Specified by:
destroyin interfaceAuthenticationHandler
-
managementOperation
public boolean managementOperation(AuthenticationToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, AuthenticationException Description copied from interface:AuthenticationHandlerPerforms an authentication management operation.This is useful for handling operations like get/renew/cancel delegation tokens which are being handled as operations of the service end-point.
If the method returns
TRUEthe request will continue normal processing, this means the method has not produced any HTTP response.If the method returns
FALSEthe request will end, this means the method has produced the corresponding HTTP response.- Specified by:
managementOperationin interfaceAuthenticationHandler- Parameters:
token- the authentication token if any, otherwiseNULL.request- the HTTP client request.response- the HTTP client response.- Returns:
TRUEif the request should be processed as a regular request,FALSEotherwise.- Throws:
IOException- thrown if an IO error occurred.AuthenticationException- thrown if an Authentication error occurred.
-
authenticate
public AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, AuthenticationException Description copied from interface:AuthenticationHandlerPerforms an authentication step for the given HTTP client request.This method is invoked by the
AuthenticationFilteronly if the HTTP client request is not yet authenticated.Depending upon the authentication mechanism being implemented, a particular HTTP client may end up making a sequence of invocations before authentication is successfully established (this is the case of Kerberos SPNEGO).
This method must return an
AuthenticationTokenonly if the the HTTP client request has been successfully and fully authenticated.If the HTTP client request has not been completely authenticated, this method must take over the corresponding HTTP response and it must return
null.- Specified by:
authenticatein interfaceAuthenticationHandler- Parameters:
request- the HTTP client request.response- the HTTP client response.- Returns:
- an
AuthenticationTokenif the HTTP client request has been authenticated,nullotherwise (in this case it must take care of the response). - Throws:
IOException- thrown if an IO error occurred.AuthenticationException- thrown if an Authentication error occurred.
-