# kite-captcha-spring-boot3-starter **Repository Path**: elfbobo_admin_admin/kite-captcha-spring-boot3-starter ## Basic Information - **Project Name**: kite-captcha-spring-boot3-starter - **Description**: 普通图形验证码[普通,GIF,中文,简单算数],行为验证码 [滑块验证、旋转验证 、滑动验证、文字点选验证] - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: v1.2.0 - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-08-21 - **Last Updated**: 2025-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # kite-captcha-spring-boot3-starter ## 使用说明 :exclamation: 未上传到中央库,需手动`clone`到本地,编译构建打包!!! ```shell mvn clean install ``` ### 添加依赖 ```xml cn.com.stary1993.kite.captcha kite-captcha-spring-boot3-starter 1.2.0 org.springframework.boot spring-boot-starter-data-redis ``` ### 添加配置 ```yaml server: port: 8088 spring: application: name: @project.name@ # 使用redis 缓存 data: redis: host: 127.0.0.1 port: 6379 database: 1 # 验证码配置 # 详细配置说明参考: META-INF/spring-configuration-metadata.json captcha: enabled: true simple: enabled: true line-count: 6 behavior: enabled: true box-background-image-list: - type: url path: "http://cdn-hsyq-static.shanhutech.cn/bizhi/staticwp/202505/73bb4f000a4897b45fad98e58df7bf52--746343205.jpg" - type: url path: "http://cdn-hsyq-static.shanhutech.cn/bizhi/staticwp/202211/b7f16c7eb37d4c0219761b4788aa6a07--2913170677.jpg" - type: url path: "http://cdn-hsyq-static.shanhutech.cn/bizhi/staticwp/202207/d7967f2c1988f1262e082b5bd88b2c53--4251048665.jpg" ``` ### 使用示例 #### 接口服务 ```java @CrossOrigin @RequiredArgsConstructor @RestController @RequestMapping("/captcha") public class CaptchaDemoController { private final SimpleImageCaptcha simpleImageCaptcha; private final BehaviorImageCaptcha behaviorImageCaptcha; /**************************** 普通验证码 **************************************/ @SneakyThrows @GetMapping("/simple/gen1") public void genSimpleImageCaptchaStream(HttpServletResponse response, @RequestParam("type") String type, String timestamp) { simpleImageCaptcha.out(SimpleImageCaptchaType.valueOf(type), timestamp, response.getOutputStream()); } @PostMapping("/simple/check1") public Boolean checkSimpleImageCaptchaStream(@RequestParam("type") String type, String timestamp, @RequestParam("code") String code) { return simpleImageCaptcha.verify(SimpleImageCaptchaType.valueOf(type), timestamp, code); } @GetMapping("/simple/gen2") public CaptchaResponse genSimpleImageCaptcha(@RequestParam("type") String type, @RequestParam("timestamp") String timestamp) { return simpleImageCaptcha.generate(SimpleImageCaptchaType.valueOf(type), timestamp); } @PostMapping("/simple/check2") public Boolean checkSimpleImageCaptcha(@RequestParam("id") String id, @RequestParam("type") String type, @RequestParam("timestamp") String timestamp, @RequestParam("code") String code) { return simpleImageCaptcha.verify(id, SimpleImageCaptchaType.valueOf(type), timestamp, code); } /**************************** 行为验证码 **************************************/ @GetMapping("/behavior/gen") public CaptchaResponse genBehaviorImageCaptcha(@RequestParam("type") String type) { return behaviorImageCaptcha.generate(type); } @PostMapping("/behavior/check") public ApiResponse checkBehaviorImageCaptcha(@RequestParam("id") String id, @RequestBody BehaviorImageCaptchaTrack imageCaptchaTrack) { return behaviorImageCaptcha.matching(id, imageCaptchaTrack); } } ``` #### [前后端分离 demo](https://gitee.com/stary1993/kite-captcha-demo/tree/v1.2.0-boot3/)