Module bus.extra

Interface CodeStrategy

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractStrategy, MathStrategy, RandomStrategy

public interface CodeStrategy extends Serializable
CAPTCHA code generation strategy.
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    Generates the CAPTCHA code.
    boolean
    verify(String code, String userInputCode)
    Verifies if the user's input string matches the generated CAPTCHA code.
  • Method Details

    • generate

      String generate()
      Generates the CAPTCHA code.
      Returns:
      The CAPTCHA code.
    • verify

      boolean verify(String code, String userInputCode)
      Verifies if the user's input string matches the generated CAPTCHA code. Users can define their own matching logic by implementing this method.
      Parameters:
      code - The randomly generated CAPTCHA code.
      userInputCode - The CAPTCHA code entered by the user.
      Returns:
      Whether the verification is successful.