Module bus.extra

Interface CaptchaProvider

All Superinterfaces:
org.miaixz.bus.core.Provider, Serializable
All Known Implementing Classes:
AbstractProvider, CircleProvider, ClickWordProvider, GifProvider, LineProvider, PuzzleProvider, ShearProvider

public interface CaptchaProvider extends org.miaixz.bus.core.Provider
CAPTCHA interface, defining the contract for CAPTCHA objects. Implementations of this interface are responsible for generating CAPTCHA images and their corresponding text.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Creates a CAPTCHA.
    get()
    Retrieves the text content of the generated CAPTCHA.
    default Object
     
    boolean
    verify(String userInputCode)
    Verifies if the user-provided CAPTCHA input matches the generated CAPTCHA text.
    void
    Writes the CAPTCHA image to the target output stream.
  • Method Details

    • create

      void create()
      Creates a CAPTCHA. Implementations should generate both a random CAPTCHA string and a CAPTCHA image.
    • get

      String get()
      Retrieves the text content of the generated CAPTCHA.
      Returns:
      The text content of the CAPTCHA.
    • verify

      boolean verify(String userInputCode)
      Verifies if the user-provided CAPTCHA input matches the generated CAPTCHA text. It is recommended to perform a case-insensitive comparison.
      Parameters:
      userInputCode - The CAPTCHA code entered by the user.
      Returns:
      true if the user input matches the generated CAPTCHA, false otherwise.
    • write

      void write(OutputStream out)
      Writes the CAPTCHA image to the target output stream.
      Parameters:
      out - The target output stream to which the CAPTCHA image will be written.
    • type

      default Object type()
      Specified by:
      type in interface org.miaixz.bus.core.Provider