feat(captcha): 升级验证码校验流程与资源管理

- 引入MatchParam封装滑动轨迹及相关信息,提升扩展性。- 调整验证码生成与校验接口,以支持更精细的参数控制。
- 优化资源管理,提高验证码资源的加载效率。
- 更新文档与示例代码,以反映API的最新变化。BREAKING CHANGE: 验证码校验接口发生改变,现在需要传入MatchParam对象而非直接传入轨迹对象。这可能会影响直接调用验证码校验服务的客户端代码,需根据最新API文档进行适配。
This commit is contained in:
天爱有情
2024-08-19 16:26:18 +08:00
parent 9324cce657
commit 407bfe87b0
22 changed files with 118 additions and 53 deletions
@@ -13,7 +13,8 @@ import lombok.*;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
// param作为扩展字段暂时将param从equals和toString中移除掉 以适应 CacheImageCaptchaGenerator
@EqualsAndHashCode(exclude = "param")
public class GenerateParam {
@@ -60,4 +61,5 @@ public class GenerateParam {
}
return param.getOrDefault(key, defaultValue);
}
}
@@ -36,7 +36,7 @@ public class RotateImageCaptchaInfo extends ImageCaptchaInfo {
rotateImageCaptchaInfo.setRandomX(randomX);
rotateImageCaptchaInfo.setBackgroundImage(backgroundImage);
rotateImageCaptchaInfo.setBackgroundImageTag(backgroundImageTag);
rotateImageCaptchaInfo.setTemplateImage(templateImageTag);
rotateImageCaptchaInfo.setTemplateImageTag(templateImageTag);
rotateImageCaptchaInfo.setTolerant(DEFAULT_TOLERANT);
rotateImageCaptchaInfo.setTemplateImage(templateImage);
rotateImageCaptchaInfo.setBackgroundImageWidth(bgImageWidth);
@@ -211,4 +211,5 @@ public class CacheImageCaptchaGenerator implements ImageCaptchaGenerator {
public void setInterceptor(CaptchaInterceptor interceptor) {
target.setInterceptor(interceptor);
}
}