- 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 TypeMethodDescriptionvoidcreate()Creates a CAPTCHA.get()Retrieves the text content of the generated CAPTCHA.default Objecttype()booleanVerifies if the user-provided CAPTCHA input matches the generated CAPTCHA text.voidwrite(OutputStream out) 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
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:
trueif the user input matches the generated CAPTCHA,falseotherwise.
-
write
Writes the CAPTCHA image to the target output stream.- Parameters:
out- The target output stream to which the CAPTCHA image will be written.
-
type
- Specified by:
typein interfaceorg.miaixz.bus.core.Provider
-