From: markt Date: Sat, 10 Jul 2010 16:19:26 +0000 (+0000) Subject: Align implementation with docs. nonceCacheSize should be configurable X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6ae94ccb165e2c383a06536ac7cd14eff5c0eb5f;p=tomcat7.0 Align implementation with docs. nonceCacheSize should be configurable git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@962872 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java b/java/org/apache/catalina/filters/CsrfPreventionFilter.java index 471324dfc..60a650c62 100644 --- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java +++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java @@ -55,7 +55,7 @@ public class CsrfPreventionFilter extends FilterBase { private final Set entryPoints = new HashSet(); - private final int nonceCacheSize = 5; + private int nonceCacheSize = 5; @Override protected Log getLogger() { @@ -79,6 +79,19 @@ public class CsrfPreventionFilter extends FilterBase { } } + /** + * 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. If not set, the default + * value of 5 will be used. + * + * @param nonceCacheSize The number of nonces to cache + */ + public void setNonceCacheSize(int nonceCacheSize) { + this.nonceCacheSize = nonceCacheSize; + } + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {