org.apache.hadoop.security.authentication.server.AuthenticationHandler, org.apache.hadoop.security.authentication.server.CompositeAuthenticationHandler@Private @Evolving public class MultiSchemeDelegationTokenAuthenticationHandler extends DelegationTokenAuthenticationHandler implements org.apache.hadoop.security.authentication.server.CompositeAuthenticationHandler
CompositeAuthenticationHandler that supports multiple HTTP
authentication schemes along with Delegation Token functionality. 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.
Internally it uses MultiSchemeAuthenticationHandler implementation.
This handler also provides an option to enable delegation token management
functionality for only a specified subset of authentication schemes. This is
required to ensure that only schemes with strongest level of security should
be used for delegation token management.
In addition to the wrapped AuthenticationHandler configuration
properties, this handler supports the following properties prefixed with the
type of the wrapped AuthenticationHandler:
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
DELEGATION_TOKEN_SCHEMES_PROPERTY |
DELEGATION_TOKEN_UGI_ATTRIBUTE, JSON_MAPPER_PREFIX, PREFIX, TOKEN_KIND, TYPE_POSTFIX| Constructor | Description |
|---|---|
MultiSchemeDelegationTokenAuthenticationHandler() |
| Modifier and Type | Method | Description |
|---|---|---|
org.apache.hadoop.security.authentication.server.AuthenticationToken |
authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
This method is overridden to restrict HTTP authentication schemes
available for delegation token management functionality.
|
java.util.Collection<java.lang.String> |
getTokenTypes() |
|
void |
init(java.util.Properties config) |
destroy, getType, initJsonFactory, initTokenManager, isManagementOperation, managementOperation, setExternalDelegationTokenSecretManagerpublic static final java.lang.String DELEGATION_TOKEN_SCHEMES_PROPERTY
public MultiSchemeDelegationTokenAuthenticationHandler()
public java.util.Collection<java.lang.String> getTokenTypes()
getTokenTypes in interface org.apache.hadoop.security.authentication.server.CompositeAuthenticationHandlerpublic void init(java.util.Properties config)
throws javax.servlet.ServletException
init in interface org.apache.hadoop.security.authentication.server.AuthenticationHandlerinit in class DelegationTokenAuthenticationHandlerjavax.servlet.ServletExceptionpublic org.apache.hadoop.security.authentication.server.AuthenticationToken authenticate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
org.apache.hadoop.security.authentication.client.AuthenticationException
DELEGATION_TOKEN_SCHEMES_PROPERTY
The basic logic here is to check if the current request is for delegation
token management. If yes then check if the request contains an
"Authorization" header. If it is missing, then return the HTTP 401
response with WWW-Authenticate header for each scheme configured for
delegation token management.
It is also possible for a client to preemptively send Authorization header
for a scheme not configured for delegation token management. We detect
this case and return the HTTP 401 response with WWW-Authenticate header
for each scheme configured for delegation token management.
If a client has sent a request with "Authorization" header for a scheme
configured for delegation token management, then it is forwarded to
underlying MultiSchemeAuthenticationHandler for actual
authentication.
Finally all other requests (excluding delegation token management) are
forwarded to underlying MultiSchemeAuthenticationHandler for
actual authentication.authenticate in interface org.apache.hadoop.security.authentication.server.AuthenticationHandlerauthenticate in class DelegationTokenAuthenticationHandlerrequest - the HTTP client request.response - the HTTP client response.java.io.IOException - thrown if an IO error occurred.org.apache.hadoop.security.authentication.client.AuthenticationException - thrown if the authentication failed.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.