Class SimpleCaptchaValidator
java.lang.Object
cloud.opencode.base.captcha.validator.SimpleCaptchaValidator
- All Implemented Interfaces:
CaptchaValidator
Simple Captcha Validator - Basic CAPTCHA validation
简单验证码验证器 - 基础验证码验证
Features | 主要功能:
- Case-insensitive answer comparison - 大小写不敏感的答案比较
- Single-use validation (answer removed after check) - 一次性验证(检查后删除答案)
Usage Examples | 使用示例:
CaptchaValidator validator = new SimpleCaptchaValidator(store);
ValidationResult result = validator.validate(captchaId, userAnswer);
Security | 安全性:
- Thread-safe: Yes (delegates to thread-safe store) - 线程安全: 是(委托给线程安全的存储)
- Null-safe: No (store, id, and answer must not be null) - 空值安全: 否(存储、ID和答案不能为null)
- Since:
- JDK 25, opencode-base-captcha V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new validator with the specified store. -
Method Summary
Modifier and TypeMethodDescriptionValidates a CAPTCHA answer.Validates a CAPTCHA answer with case sensitivity option.
-
Constructor Details
-
SimpleCaptchaValidator
Creates a new validator with the specified store. 使用指定存储创建新验证器。- Parameters:
store- the CAPTCHA store | 验证码存储
-
-
Method Details
-
validate
Description copied from interface:CaptchaValidatorValidates a CAPTCHA answer. 验证验证码答案。- Specified by:
validatein interfaceCaptchaValidator- Parameters:
id- the CAPTCHA ID | 验证码 IDanswer- the provided answer | 提供的答案- Returns:
- the validation result | 验证结果
-
validate
Description copied from interface:CaptchaValidatorValidates a CAPTCHA answer with case sensitivity option. 验证验证码答案(带大小写敏感选项)。- Specified by:
validatein interfaceCaptchaValidator- Parameters:
id- the CAPTCHA ID | 验证码 IDanswer- the provided answer | 提供的答案caseSensitive- whether case sensitive | 是否区分大小写- Returns:
- the validation result | 验证结果
-