Class DelegationTokenAuthenticationFilter
java.lang.Object
org.apache.hadoop.security.authentication.server.AuthenticationFilter
org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter
- All Implemented Interfaces:
javax.servlet.Filter
@Private
@Evolving
public class DelegationTokenAuthenticationFilter
extends org.apache.hadoop.security.authentication.server.AuthenticationFilter
The
DelegationTokenAuthenticationFilter filter is a
AuthenticationFilter with Hadoop Delegation Token support.
By default it uses it own instance of the AbstractDelegationTokenSecretManager. For situations where an external
AbstractDelegationTokenSecretManager is required (i.e. one that
shares the secret with AbstractDelegationTokenSecretManager
instance running in other services), the external
AbstractDelegationTokenSecretManager must be set as an
attribute in the ServletContext of the web application using the
DELEGATION_TOKEN_SECRET_MANAGER_ATTR attribute name (
'hadoop.http.delegation-token-secret-manager').
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSets an externalDelegationTokenSecretManagerinstance to manage creation and verification of Delegation Tokens.static final StringFields inherited from class org.apache.hadoop.security.authentication.server.AuthenticationFilter
AUTH_TOKEN_MAX_INACTIVE_INTERVAL, AUTH_TOKEN_VALIDITY, AUTH_TYPE, CONFIG_PREFIX, COOKIE_DOMAIN, COOKIE_PATH, COOKIE_PERSISTENT, SIGNATURE_SECRET, SIGNATURE_SECRET_FILE, SIGNER_SECRET_PROVIDER, SIGNER_SECRET_PROVIDER_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoFilter(javax.servlet.FilterChain filterChain, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected PropertiesgetConfiguration(String configPrefix, javax.servlet.FilterConfig filterConfig) It delegates toAuthenticationFilter.getConfiguration(String, FilterConfig)and then overrides theAuthenticationHandlerto use if authentication type is set tosimpleorkerberosin order to use the corresponding implementation with delegation token support.protected ConfigurationgetProxyuserConfiguration(javax.servlet.FilterConfig filterConfig) Returns the proxyuser configuration.voidinit(javax.servlet.FilterConfig filterConfig) protected voidinitializeAuthHandler(String authHandlerClassName, javax.servlet.FilterConfig filterConfig) protected voidsetAuthHandlerClass(Properties props) Set AUTH_TYPE property to the name of the corresponding authentication handler class based on the input properties.protected voidsetHandlerAuthMethod(SaslRpcServer.AuthMethod authMethod) Methods inherited from class org.apache.hadoop.security.authentication.server.AuthenticationFilter
constructSecretProvider, createAuthCookie, destroy, doFilter, getAuthenticationHandler, getConfiguration, getCookieDomain, getCookiePath, getMaxInactiveInterval, getRequestURL, getToken, getValidity, initializeSecretProvider, isCookiePersistent, isCustomSignerSecretProvider, isRandomSecret, verifyTokenType
-
Field Details
-
DELEGATION_TOKEN_SECRET_MANAGER_ATTR
Sets an externalDelegationTokenSecretManagerinstance to manage creation and verification of Delegation Tokens.This is useful for use cases where secrets must be shared across multiple services.
- See Also:
-
PROXYUSER_PREFIX
- See Also:
-
-
Constructor Details
-
DelegationTokenAuthenticationFilter
public DelegationTokenAuthenticationFilter()
-
-
Method Details
-
getConfiguration
protected Properties getConfiguration(String configPrefix, javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException It delegates toAuthenticationFilter.getConfiguration(String, FilterConfig)and then overrides theAuthenticationHandlerto use if authentication type is set tosimpleorkerberosin order to use the corresponding implementation with delegation token support.- Overrides:
getConfigurationin classorg.apache.hadoop.security.authentication.server.AuthenticationFilter- Parameters:
configPrefix- parameter not used.filterConfig- parameter not used.- Returns:
- hadoop-auth de-prefixed configuration for the filter and handler.
- Throws:
javax.servlet.ServletException
-
setAuthHandlerClass
Set AUTH_TYPE property to the name of the corresponding authentication handler class based on the input properties.- Parameters:
props- input properties.- Throws:
javax.servlet.ServletException- servlet exception.
-
getProxyuserConfiguration
protected Configuration getProxyuserConfiguration(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException Returns the proxyuser configuration. All returned properties must start withproxyuser.'Subclasses may override this method if the proxyuser configuration is read from other place than the filter init parameters.
- Parameters:
filterConfig- filter configuration object- Returns:
- the proxyuser configuration properties.
- Throws:
javax.servlet.ServletException- thrown if the configuration could not be created.
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException - Specified by:
initin interfacejavax.servlet.Filter- Overrides:
initin classorg.apache.hadoop.security.authentication.server.AuthenticationFilter- Throws:
javax.servlet.ServletException
-
initializeAuthHandler
protected void initializeAuthHandler(String authHandlerClassName, javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException - Overrides:
initializeAuthHandlerin classorg.apache.hadoop.security.authentication.server.AuthenticationFilter- Throws:
javax.servlet.ServletException
-
setHandlerAuthMethod
-
doFilter
protected void doFilter(javax.servlet.FilterChain filterChain, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException - Overrides:
doFilterin classorg.apache.hadoop.security.authentication.server.AuthenticationFilter- Throws:
IOExceptionjavax.servlet.ServletException
-