public class ESAPIWebApplicationFirewallFilter
extends java.lang.Object
implements javax.servlet.Filter
| Modifier and Type | Field and Description |
|---|---|
private AppGuardianConfiguration |
appGuardConfig |
private static java.lang.String |
CONFIGURATION_FILE_PARAM |
private java.lang.String |
configurationFilename |
private static int |
DEFAULT_POLLING_TIME |
private javax.servlet.FilterConfig |
fc |
private long |
lastConfigReadTime |
private Logger |
logger |
private static java.lang.String |
LOGGING_FILE_PARAM |
private static java.lang.String |
POLLING_TIME_PARAM |
private long |
pollingTime |
| Constructor and Description |
|---|
ESAPIWebApplicationFirewallFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain chain)
This is the where the main interception and rule-checking logic of the WAF resides.
|
AppGuardianConfiguration |
getConfiguration() |
void |
init(javax.servlet.FilterConfig fc)
This function is invoked at application startup and when the configuration file
polling period has elapsed and a change in the configuration file has been detected.
|
private void |
sendRedirect(InterceptingHTTPServletResponse response,
javax.servlet.http.HttpServletResponse httpResponse) |
private void |
sendRedirect(InterceptingHTTPServletResponse response,
javax.servlet.http.HttpServletResponse httpResponse,
java.lang.String redirectURL) |
void |
setConfiguration(java.lang.String policyFilePath,
java.lang.String webRootDir)
This function is used in testing to dynamically alter the configuration.
|
private AppGuardianConfiguration appGuardConfig
private static final java.lang.String CONFIGURATION_FILE_PARAM
private static final java.lang.String LOGGING_FILE_PARAM
private static final java.lang.String POLLING_TIME_PARAM
private static final int DEFAULT_POLLING_TIME
private java.lang.String configurationFilename
private long pollingTime
private long lastConfigReadTime
private javax.servlet.FilterConfig fc
private final Logger logger
public void setConfiguration(java.lang.String policyFilePath,
java.lang.String webRootDir)
throws java.io.FileNotFoundException
policyFilePath - The path to the policy filewebRootDir - The root directory of the web application.java.io.FileNotFoundException - if the policy file cannot be locatedpublic AppGuardianConfiguration getConfiguration()
public void init(javax.servlet.FilterConfig fc)
throws javax.servlet.ServletException
doFilter() method.init in interface javax.servlet.Filterjavax.servlet.ServletExceptionpublic void doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.Filterjava.io.IOExceptionjavax.servlet.ServletExceptionprivate void sendRedirect(InterceptingHTTPServletResponse response, javax.servlet.http.HttpServletResponse httpResponse, java.lang.String redirectURL) throws java.io.IOException
java.io.IOExceptionpublic void destroy()
destroy in interface javax.servlet.Filterprivate void sendRedirect(InterceptingHTTPServletResponse response, javax.servlet.http.HttpServletResponse httpResponse) throws java.io.IOException
java.io.IOException