@InterfaceAudience.Private @InterfaceStability.Evolving public class MultiSchemeAuthenticationHandler extends Object implements 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:
Modifier and Type | Field and Description |
---|---|
static String |
AUTH_HANDLER_PROPERTY |
static String |
SCHEMES_PROPERTY |
static String |
TYPE
Constant that identifies the authentication mechanism.
|
WWW_AUTHENTICATE
Constructor and Description |
---|
MultiSchemeAuthenticationHandler() |
MultiSchemeAuthenticationHandler(String authType) |
Modifier and Type | Method and Description |
---|---|
AuthenticationToken |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Performs an authentication step for the given HTTP client request.
|
void |
destroy()
Destroys the authentication handler instance.
|
Collection<String> |
getTokenTypes()
This method returns the token types supported by this authentication
handler.
|
String |
getType()
Returns the authentication type of the authentication handler.
|
void |
init(Properties config)
Initializes the authentication handler instance.
|
protected AuthenticationHandler |
initializeAuthHandler(String authHandlerClassName,
Properties config) |
boolean |
managementOperation(AuthenticationToken token,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Performs an authentication management operation.
|
public static final String SCHEMES_PROPERTY
public static final String AUTH_HANDLER_PROPERTY
public static final String TYPE
public MultiSchemeAuthenticationHandler()
public MultiSchemeAuthenticationHandler(String authType)
public String getType()
AuthenticationHandler
getType
in interface AuthenticationHandler
public Collection<String> getTokenTypes()
getTokenTypes
in interface CompositeAuthenticationHandler
public void init(Properties config) throws javax.servlet.ServletException
AuthenticationHandler
This method is invoked by the AuthenticationFilter.init(javax.servlet.FilterConfig)
method.
init
in interface AuthenticationHandler
config
- configuration properties to initialize the handler.javax.servlet.ServletException
- thrown if the handler could not be initialized.protected AuthenticationHandler initializeAuthHandler(String authHandlerClassName, Properties config) throws javax.servlet.ServletException
javax.servlet.ServletException
public void destroy()
AuthenticationHandler
This method is invoked by the AuthenticationFilter.destroy()
method.
destroy
in interface AuthenticationHandler
public boolean managementOperation(AuthenticationToken token, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, AuthenticationException
AuthenticationHandler
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 TRUE
the request will continue normal
processing, this means the method has not produced any HTTP response.
If the method returns FALSE
the request will end, this means
the method has produced the corresponding HTTP response.
managementOperation
in interface AuthenticationHandler
token
- the authentication token if any, otherwise NULL
.request
- the HTTP client request.response
- the HTTP client response.TRUE
if the request should be processed as a regular
request,
FALSE
otherwise.IOException
- thrown if an IO error occurred.AuthenticationException
- thrown if an Authentication error occurred.public AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, AuthenticationException
AuthenticationHandler
This method is invoked by the AuthenticationFilter
only 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 AuthenticationToken
only 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
.
authenticate
in interface AuthenticationHandler
request
- the HTTP client request.response
- the HTTP client response.AuthenticationToken
if the HTTP client request has been authenticated,
null
otherwise (in this case it must take care of the response).IOException
- thrown if an IO error occurred.AuthenticationException
- thrown if an Authentication error occurred.Copyright © 2022 Apache Software Foundation. All rights reserved.