public class AuthFilter extends org.apache.hadoop.security.authentication.server.AuthenticationFilter
Modifier and Type | Field and Description |
---|---|
static String |
OOZIE_PREFIX |
Constructor and Description |
---|
AuthFilter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the filter.
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain filterChain)
Enforces authentication using Hadoop-auth AuthenticationFilter.
|
protected Properties |
getConfiguration(String configPrefix,
javax.servlet.FilterConfig filterConfig)
Returns the configuration from Oozie configuration to be used by the authentication filter.
|
void |
init(javax.servlet.FilterConfig filterConfig)
Initialize the filter.
|
public static final String OOZIE_PREFIX
public AuthFilter()
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
init
in class org.apache.hadoop.security.authentication.server.AuthenticationFilter
filterConfig
- filter configuration.javax.servlet.ServletException
- thrown if the filter could not be initialized.public void destroy()
destroy
in interface javax.servlet.Filter
destroy
in class org.apache.hadoop.security.authentication.server.AuthenticationFilter
protected Properties getConfiguration(String configPrefix, javax.servlet.FilterConfig filterConfig)
All properties from Oozie configuration which name starts with OOZIE_PREFIX
will
be returned. The keys of the returned properties are trimmed from the OOZIE_PREFIX
prefix, for example the Oozie configuration property name 'oozie.authentication.type' will
be just 'type'.
getConfiguration
in class org.apache.hadoop.security.authentication.server.AuthenticationFilter
configPrefix
- configuration prefix, this parameter is ignored by this implementation.filterConfig
- filter configuration, this parameter is ignored by this implementation.OOZIE_PREFIX
, without the
prefix.public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
This method is overriden to respond to HTTP OPTIONS requests for authenticated calls, regardless of the target servlet supporting OPTIONS or not and to inject the authenticated user name as request attribute for Oozie to retrieve the user id.
doFilter
in interface javax.servlet.Filter
doFilter
in class org.apache.hadoop.security.authentication.server.AuthenticationFilter
request
- http request.response
- http response.filterChain
- filter chain.IOException
- thrown if an IO error occurs.javax.servlet.ServletException
- thrown if a servlet error occurs.Copyright © 2018 Apache Software Foundation. All rights reserved.