java.lang.Object
org.miaixz.bus.extra.captcha.AbstractProvider
org.miaixz.bus.extra.captcha.provider.ClickWordProvider
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Provider,CaptchaProvider
Click Word CAPTCHA Provider.
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Field Summary
Fields inherited from class org.miaixz.bus.extra.captcha.AbstractProvider
background, code, font, generator, height, imageBytes, interfereCount, textAlpha, width -
Constructor Summary
ConstructorsConstructorDescriptionClickWordProvider(int width, int height, int codeCount, int interfereCount) Constructor.ClickWordProvider(int width, int height, CodeStrategy generator, int interfereCount) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected ImagecreateImage(String code) Creates the CAPTCHA image based on the generated code.get()Retrieves the text content of the generated CAPTCHA.booleanVerifies if the user-provided CAPTCHA input matches the generated CAPTCHA text.Methods inherited from class org.miaixz.bus.extra.captcha.AbstractProvider
create, generateCode, getGenerator, getImage, getImageBase64, getImageBase64Data, getImageBytes, setBackground, setFont, setGenerator, setTextAlpha, write, write, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.extra.captcha.CaptchaProvider
type
-
Constructor Details
-
ClickWordProvider
public ClickWordProvider(int width, int height, int codeCount, int interfereCount) Constructor.- Parameters:
width- Image width.height- Image height.codeCount- Number of characters.interfereCount- Number of interfering elements.
-
ClickWordProvider
Constructor.- Parameters:
width- Image width.height- Image height.generator- CAPTCHA code generator.interfereCount- Number of interfering elements.
-
-
Method Details
-
createImage
Description copied from class:AbstractProviderCreates the CAPTCHA image based on the generated code.- Specified by:
createImagein classAbstractProvider- Parameters:
code- The CAPTCHA code.- Returns:
- The CAPTCHA image.
-
get
Description copied from interface:CaptchaProviderRetrieves the text content of the generated CAPTCHA.- Specified by:
getin interfaceCaptchaProvider- Overrides:
getin classAbstractProvider- Returns:
- The text content of the CAPTCHA.
-
verify
Description copied from interface:CaptchaProviderVerifies if the user-provided CAPTCHA input matches the generated CAPTCHA text. It is recommended to perform a case-insensitive comparison.- Specified by:
verifyin interfaceCaptchaProvider- Overrides:
verifyin classAbstractProvider- Parameters:
inputCode- The CAPTCHA code entered by the user.- Returns:
trueif the user input matches the generated CAPTCHA,falseotherwise.
-