diff --git a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java index a5768b4d99..eb1bb8b79b 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java +++ b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessor.java @@ -19,8 +19,11 @@ package org.springframework.security.captcha; /** - *

return false if ny CaptchaChannelProcessorTemplate of mapped urls has been requested more than thresold;
- * Default keyword : REQUIRES_CAPTCHA_ABOVE_THRESOLD_REQUESTS

+ * Return false if the number of requests for captcha protcted URLs for the user + * exceeds the threshold value. + * + *
+ * Default keyword : REQUIRES_CAPTCHA_ABOVE_THRESHOLD_REQUESTS * * @author Marc-Antoine Garrigue * @version $Id$ @@ -33,9 +36,6 @@ public class AlwaysTestAfterMaxRequestsCaptchaChannelProcessor extends CaptchaCh //~ Constructors =================================================================================================== - /** - * Constructor - */ public AlwaysTestAfterMaxRequestsCaptchaChannelProcessor() { this.setKeyword(DEFAULT_KEYWORD); } @@ -43,11 +43,8 @@ public class AlwaysTestAfterMaxRequestsCaptchaChannelProcessor extends CaptchaCh //~ Methods ======================================================================================================== /** - * Verify whether the context is valid concerning humanity * - * @param context - * - * @return true if valid, false otherwise + * @return false if the number of requests for captcha protected URLs exceeds the threshold. */ boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) { if (context.getHumanRestrictedResourcesRequestsCount() < getThreshold()) { diff --git a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java index d138b2e13f..487e39b652 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java +++ b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestAfterTimeInMillisCaptchaChannelProcessor.java @@ -16,8 +16,8 @@ package org.springframework.security.captcha; /** - *

return false if thresold is greater than millis since last captcha test has occured;
- * Default keyword : REQUIRES_CAPTCHA_AFTER_THRESOLD_IN_MILLIS

+ * Return false if the time in millis since the last captcha test is less than the threshold;
+ * Default keyword : REQUIRES_CAPTCHA_AFTER_THRESHOLD_IN_MILLIS. * * @author Marc-Antoine Garrigue * @version $Id$ @@ -30,9 +30,6 @@ public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessor extends CaptchaC //~ Constructors =================================================================================================== - /** - * Constructor - */ public AlwaysTestAfterTimeInMillisCaptchaChannelProcessor() { this.setKeyword(DEFAULT_KEYWORD); @@ -41,19 +38,19 @@ public class AlwaysTestAfterTimeInMillisCaptchaChannelProcessor extends CaptchaC //~ Methods ======================================================================================================== /** - * Verify wheter the context is valid concerning humanity + * Returns false if the time (in milliseconds) since the last captcha validation is greater than the + * threshold value. * * @param context the CaptchaSecurityContext * - * @return true if valid, false otherwise */ boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) { if ((System.currentTimeMillis() - context.getLastPassedCaptchaDateInMillis()) < getThreshold()) { - logger.debug("context is valid : last passed captcha date - current time < thresold"); + logger.debug("context is valid : current time - last passed captcha date < threshold"); return true; } else { - logger.debug("context is not valid : last passed captcha date - current time > thresold"); + logger.debug("context is not valid : current time - last passed captcha date > threshold"); return false; } diff --git a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java index 45b43fdf7f..d39a3116ab 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java +++ b/captcha/src/main/java/org/springframework/security/captcha/AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor.java @@ -19,10 +19,10 @@ import org.springframework.util.Assert; /** - *

return false if thresold is lower than average time millis between any CaptchaChannelProcessorTemplate mapped - * urls requests and is human;
- * Default keyword : REQUIRES_CAPTCHA_BELOW_AVERAGE_TIME_IN_MILLIS_REQUESTS
- * Note : before first humanity check

+ * Return false if the average time in millis between any CaptchaChannelProcessorTemplate mapped + * urls requests is greater than the threshold value or the context is not human;
+ * Default keyword : REQUIRES_CAPTCHA_BELOW_AVERAGE_TIME_IN_MILLIS_REQUESTS
+ * Note : before first humanity check * * @author Marc-Antoine Garrigue * @version $Id$ @@ -35,9 +35,6 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e //~ Constructors =================================================================================================== - /** - * Constructor - */ public AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor() { this.setKeyword(DEFAULT_KEYWORD); } @@ -45,7 +42,7 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e //~ Methods ======================================================================================================== /** - * Verify if thresold is > 0 + * Verify that threshold is > 0 * * @throws Exception if false */ @@ -55,11 +52,7 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e } /** - * Verify wheter the context is valid concerning humanity - * - * @param context - * - * @return true if valid, false otherwise + * */ boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) { int req = context.getHumanRestrictedResourcesRequestsCount(); @@ -74,11 +67,11 @@ public class AlwaysTestBelowAverageTimeInMillisBetweenRequestsChannelProcessor e } if (context.isHuman() && (average > thresold)) { - logger.debug("context is valid : average time between requests < thresold && is human"); + logger.debug("context is valid : average time between requests < threshold && is human"); return true; } else { - logger.debug("context is not valid : request count > thresold or is not human"); + logger.debug("context is not valid : average time between requests > threshold or is not human"); return false; } diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaChannelProcessorTemplate.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaChannelProcessorTemplate.java index 46c0c69338..6326153cff 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaChannelProcessorTemplate.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaChannelProcessorTemplate.java @@ -40,21 +40,21 @@ import javax.servlet.ServletException; /** - *

CaptchaChannel template : Ensures the user has enough human privileges by review of the {@link + * CaptchaChannel template : Ensures the user has enough human privileges by review of the {@link * CaptchaSecurityContext} and using an abstract routine {@link - * #isContextValidConcerningHumanity(CaptchaSecurityContext)} (implemented by sub classes)

- *

The component uses 2 main parameters for its configuration : + * #isContextValidConcerningHumanity(CaptchaSecurityContext)} (implemented by sub classes) + *

The component uses 2 main parameters for its configuration : *

*

* - * @author marc antoine Garrigue + * @author Marc-Antoine Garrigue * @version $Id$ */ public abstract class CaptchaChannelProcessorTemplate implements ChannelProcessor, InitializingBean { diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaEntryPoint.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaEntryPoint.java index 451b21f4ca..8b3c27f619 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaEntryPoint.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaEntryPoint.java @@ -47,7 +47,6 @@ import javax.servlet.http.HttpServletResponse; * The captcha entry point : redirect to the captcha test page. *

* This entry point can force the use of SSL : see {@link #getForceHttps()} - *

*

* This entry point allows internal OR external redirect : see {@link #setOutsideWebApp(boolean)}
* / Original request can be added to the redirect path using a custom translation : see @@ -82,7 +81,7 @@ import javax.servlet.http.HttpServletResponse; * *

* - * @author marc antoine Garrigue + * @author Marc-Antoine Garrigue * @version $Id$ */ public class CaptchaEntryPoint implements ChannelEntryPoint, InitializingBean { @@ -326,10 +325,8 @@ public class CaptchaEntryPoint implements ChannelEntryPoint, InitializingBean { this.captchaFormUrl = captchaFormUrl; } - // ~ Methods - // ================================================================ /** - * Set to true to force captcha form access to be via https. If this value is ture (the default is false), + * Set to true to force captcha form access to be via https. If this value is true (the default is false), * and the incoming request for the protected resource which triggered the interceptor was not already * https, then * diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContext.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContext.java index 1bd1bc7785..d79f53d047 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContext.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContext.java @@ -19,41 +19,39 @@ import org.springframework.security.context.SecurityContext; /** - * Interface that add humanity concerns to the SecurityContext + * Interface that adds humanity concerns to the SecurityContext * - * @author marc antoine garrigue + * @author Marc-Antoine Garrigue + * @version $Id$ */ public interface CaptchaSecurityContext extends SecurityContext { //~ Methods ======================================================================================================== /** - * DOCUMENT ME! * - * @return number of human restricted resources requests since the last passed captcha. + * @return the number of human restricted resources requested since the last passed captcha. */ int getHumanRestrictedResourcesRequestsCount(); /** - * DOCUMENT ME! * * @return the date of the last passed Captcha in millis, 0 if the user never passed captcha. */ long getLastPassedCaptchaDateInMillis(); /** - * Method to increment the human Restricted Resrouces Requests Count; + * Increments the human Restricted Resources Requests Count. */ void incrementHumanRestrictedResourcesRequestsCount(); /** - * DOCUMENT ME! * * @return true if the current user has already passed a captcha. */ boolean isHuman(); /** - * set human attribute, should called after captcha validation. + * set human attribute, should be called after captcha validation. */ void setHuman(); } diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContextImpl.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContextImpl.java index c1db91d35f..e4a20081be 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContextImpl.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaSecurityContextImpl.java @@ -21,7 +21,8 @@ import org.springframework.security.context.SecurityContextImpl; /** * Default CaptchaSecurityContext implementation * - * @author mag + * @author Marc-Antoine Garrigue + * @version $Id$ */ public class CaptchaSecurityContextImpl extends SecurityContextImpl implements CaptchaSecurityContext { //~ Instance fields ================================================================================================ @@ -33,7 +34,6 @@ public class CaptchaSecurityContextImpl extends SecurityContextImpl implements C //~ Constructors =================================================================================================== public CaptchaSecurityContextImpl() { - super(); human = false; lastPassedCaptchaDate = 0; humanRestrictedResourcesRequestsCount = 0; @@ -84,7 +84,7 @@ public class CaptchaSecurityContextImpl extends SecurityContextImpl implements C } /** - * Method to increment the human Restricted Resrouces Requests Count; + * Method to increment the human Restricted Resources Requests Count; */ public void incrementHumanRestrictedResourcesRequestsCount() { humanRestrictedResourcesRequestsCount++; diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaServiceProxy.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaServiceProxy.java index ae1c946099..0aa9597647 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaServiceProxy.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaServiceProxy.java @@ -18,14 +18,13 @@ package org.springframework.security.captcha; /** * Provide a common interface for captcha validation. * - * @author marc antoine Garrigue + * @author Marc-Antoine Garrigue * @version $Id$ */ public interface CaptchaServiceProxy { //~ Methods ======================================================================================================== /** - * DOCUMENT ME! * * @param id the id token * @param captchaResponse the user response diff --git a/captcha/src/main/java/org/springframework/security/captcha/CaptchaValidationProcessingFilter.java b/captcha/src/main/java/org/springframework/security/captcha/CaptchaValidationProcessingFilter.java index 980ccac44f..eeb6c9bbcc 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/CaptchaValidationProcessingFilter.java +++ b/captcha/src/main/java/org/springframework/security/captcha/CaptchaValidationProcessingFilter.java @@ -30,12 +30,15 @@ import javax.servlet.http.HttpSession; /** - * Filter for web integration of the {@link CaptchaServiceProxy}.
- * It basically intercept calls containing the specific validation parameter, use the {@link CaptchaServiceProxy} to - * validate the request, and update the {@link CaptchaSecurityContext} if the request passed the validation.
+ * Filter for web integration of the {@link CaptchaServiceProxy}. + *

+ * It basically intercept calls containing the specific validation parameter, uses the {@link CaptchaServiceProxy} to + * validate the request, and update the {@link CaptchaSecurityContext} if the request passed the validation. + *

* This Filter should be placed after the ContextIntegration filter and before the {@link * CaptchaChannelProcessorTemplate} filter in the filter stack in order to update the {@link CaptchaSecurityContext} - * before the humanity verification routine occurs.
+ * before the humanity verification routine occurs. + *

* This filter should only be used in conjunction with the {@link CaptchaSecurityContext}
* * @author marc antoine Garrigue diff --git a/captcha/src/main/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java b/captcha/src/main/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java index 0c980fa3e8..3e7d9f60c3 100644 --- a/captcha/src/main/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java +++ b/captcha/src/main/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessor.java @@ -16,9 +16,9 @@ package org.springframework.security.captcha; /** - *

return false if ny CaptchaChannelProcessorTemplate mapped urls has been requested more than thresold and + * Return false if any CaptchaChannelProcessorTemplate mapped urls have been requested more than threshold and * humanity is false;
- * Default keyword : REQUIRES_CAPTCHA_ONCE_ABOVE_THRESOLD_REQUESTS

+ * Default keyword : REQUIRES_CAPTCHA_ONCE_ABOVE_THRESHOLD_REQUESTS

* * @author Marc-Antoine Garrigue * @version $Id$ @@ -26,7 +26,7 @@ package org.springframework.security.captcha; public class TestOnceAfterMaxRequestsCaptchaChannelProcessor extends CaptchaChannelProcessorTemplate { //~ Static fields/initializers ===================================================================================== - public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_ONCE_ABOVE_THRESOLD_REQUESTS"; + public static final String DEFAULT_KEYWORD = "REQUIRES_CAPTCHA_ONCE_ABOVE_THRESHOLD_REQUESTS"; //~ Constructors =================================================================================================== @@ -38,11 +38,11 @@ public class TestOnceAfterMaxRequestsCaptchaChannelProcessor extends CaptchaChan boolean isContextValidConcerningHumanity(CaptchaSecurityContext context) { if (context.isHuman() || (context.getHumanRestrictedResourcesRequestsCount() < getThreshold())) { - logger.debug("context is valid concerning humanity or request count < thresold"); + logger.debug("context is valid concerning humanity or request count < threshold"); return true; } else { - logger.debug("context is not valid concerning humanity and request count > thresold"); + logger.debug("context is not valid concerning humanity and request count > threshold"); return false; } diff --git a/captcha/src/test/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java b/captcha/src/test/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java index 70214724ab..51444843a7 100644 --- a/captcha/src/test/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java +++ b/captcha/src/test/java/org/springframework/security/captcha/AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests.java @@ -19,9 +19,7 @@ import junit.framework.TestCase; /** - * - * @author $author$ - * @version $Revision: 2142 $ + * @author Marc-Antoine Garrigue */ public class AlwaysTestAfterMaxRequestsCaptchaChannelProcessorTests extends TestCase { //~ Instance fields ================================================================================================ diff --git a/captcha/src/test/java/org/springframework/security/captcha/MockCaptchaServiceProxy.java b/captcha/src/test/java/org/springframework/security/captcha/MockCaptchaServiceProxy.java index 1919929d32..af00da0462 100644 --- a/captcha/src/test/java/org/springframework/security/captcha/MockCaptchaServiceProxy.java +++ b/captcha/src/test/java/org/springframework/security/captcha/MockCaptchaServiceProxy.java @@ -16,9 +16,7 @@ package org.springframework.security.captcha; /** - * DOCUMENT ME! - * - * @author marc antoine Garrigue + * @author Marc-Antoine Garrigue * @version $Id$ */ public class MockCaptchaServiceProxy implements CaptchaServiceProxy { diff --git a/captcha/src/test/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java b/captcha/src/test/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java index 162ee5a01f..5337ea41b4 100644 --- a/captcha/src/test/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java +++ b/captcha/src/test/java/org/springframework/security/captcha/TestOnceAfterMaxRequestsCaptchaChannelProcessorTests.java @@ -21,9 +21,8 @@ import org.springframework.security.captcha.TestOnceAfterMaxRequestsCaptchaChann /** - * DOCUMENT ME! * - * @author $author$ + * @author Marc-Antoine Garrigue * @version $Revision: 2142 $ */ public class TestOnceAfterMaxRequestsCaptchaChannelProcessorTests extends TestCase {