public class CsrfPreventionFilter extends FilterBase
HttpServletResponse#encodeRedirectURL(String) and
HttpServletResponse#encodeURL(String) are used to encode all URLs
returned to the client
| Modifier and Type | Class and Description |
|---|---|
protected static class |
CsrfPreventionFilter.CsrfResponseWrapper |
sm| Constructor and Description |
|---|
CsrfPreventionFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) |
protected java.lang.String |
generateNonce()
Generate a once time token (nonce) for authenticating subsequent
requests.
|
void |
init(FilterConfig filterConfig) |
void |
setEntryPoints(java.lang.String entryPoints)
Entry points are URLs that will not be tested for the presence of a valid
nonce.
|
void |
setNonceCacheSize(int nonceCacheSize)
Sets the number of previously issued nonces that will be cached on a LRU
basis to support parallel requests, limited use of the refresh and back
in the browser and similar behaviors that may result in the submission
of a previous nonce rather than the current one.
|
void |
setRandomClass(java.lang.String randomClass)
Specify the class to use to generate the nonces.
|
destroypublic void setEntryPoints(java.lang.String entryPoints)
entryPoints - Comma separated list of URLs to be configured as
entry points.public void setNonceCacheSize(int nonceCacheSize)
nonceCacheSize - The number of nonces to cachepublic void setRandomClass(java.lang.String randomClass)
Random.randomClass - The name of the class to usepublic void init(FilterConfig filterConfig)
throws ServletException
init in class FilterBaseServletExceptionpublic void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws java.io.IOException,
ServletException
java.io.IOExceptionServletExceptionprotected java.lang.String generateNonce()