All Implemented Interfaces:
Captcha, LogEnabled, PluginAware, Configurable

public class JCaptcha extends AbstractCaptcha
Captcha implementation with images
  • Field Details

  • Constructor Details

  • Method Details

    • checkAndInvalidateCaptcha

      public boolean checkAndInvalidateCaptcha(String key, String value)
      Description copied from interface: Captcha
      Check if the Captcha is correct
      Parameters:
      key - the key
      value - the value
      Returns:
      true if correct
    • getLabel

      Description copied from interface: Captcha
      Get the Captcha type label
      Returns:
      the label
    • getLoginFailedBecauseCaptchaFailedLabel

      Description copied from interface: Captcha
      Get the label to display when login has failed with this captcha
      Returns:
      the label
    • getLoginFailedBecauseTooManyAttemptLabel

      Description copied from interface: Captcha
      Get the label to display when too many attempt have been done
      Returns:
      the label
    • getUsedUrlPatterns

      Description copied from interface: Captcha
      Get the minimal url patterns used by the captcha implementation. This is necessary to grant those url even when the user is not authentified (in particular to set a catpcha on the login page). Do no put a too wide range (such as ^.*$) since it may introduce security issues.
      Returns:
      The minimal url patterns used by the captcha implementation.
    • generateImageCaptcha

      public BufferedImage generateImageCaptcha(String key, Integer color, boolean addNoise, boolean fisheye, int width, int height)
      Generate an image captcha to PNG format. The key has to be unique, if you cannot generate a key use the other form of the method.
      Parameters:
      key - the wanted key. Can not be null. You can use RandomStringUtils.randomAlphanumeric(10) to generates one
      color - The color for font
      addNoise - true to add noise to captcha image
      fisheye - true to add fish eye background to captcha image
      width - The image width
      height - The image height
      Returns:
      The corresponding image
    • removeCaptcha

      public void removeCaptcha(String key)
      Remove a captcha
      Parameters:
      key - the key value
    • cleanOldCaptchas

      public void cleanOldCaptchas()
      Clean the outdated captchas