# captcha-plus **Repository Path**: yudaocode/captcha-plus ## Basic Information - **Project Name**: captcha-plus - **Description**: 行为验证码(滑动拼图、点选文字),前后端(java)交互,包含vue/h5/Android/IOS/flutter/uni-app/react/php/go/微信小程序的源码和实现 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 217 - **Forks**: 86 - **Created**: 2023-01-13 - **Last Updated**: 2025-06-18 ## Categories & Tags **Categories**: captcha **Tags**: 验证码, 滑块验证码, Captcha, Java, SpringBoot ## README # captcha-plus ## 简介 * Captcha-plus行为验证码,包含滑动拼图、文字点选两种方式,UI支持弹出和嵌入两种方式。后端提供Java实现,前端提供了php、angular、html、vue、uni-app、flutter、android、ios等代码示例。 ## 集成项目 - [Vue3 Ant Design Vue](https://gitee.com/xingyuv/yudao-ui-admin-vben/) - [Vue3 Element-Plus](https://gitee.com/yudaocode/yudao-ui-admin-vue3/) - [Vue2 Element-UI](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master/yudao-ui-admin/) - [Vue2 UniAPP](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master/yudao-ui-admin-uniapp/) - [SpringBoot](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master/yudao-framework/yudao-spring-boot-starter-captcha) ## 外包项目请联系 [ xinyu370 ] - ![alt 定制开发](./images/wx2.png) ## 安装 ### 1.Maven 在项目的pom.xml的dependencies中加入以下内容: spring mvc ``` xml com.xingyuv captcha-plus 1.0.10 ``` spring boot 2 使用 main 分支 ``` xml com.xingyuv spring-boot-starter-captcha-plus 1.0.10 ``` spring boot 3 请使用 2.x 分支 ``` xml com.xingyuv spring-boot-starter-captcha-plus 2.0.1 ``` ### 2.验证码接口 - [参考 springboot2 demo](./demo/springboot.java) - [参考 springboot3 demo](./demo/springboot3.java) ### 功能概述 #### 组件介绍 * 行为验证码采用嵌入式集成方式,接入方便,安全,高效。抛弃了传统字符型验证码展示-填写字符-比对答案的流程,采用验证码展示-采集用户行为-分析用户行为流程,用户只需要产生指定的行为轨迹,不需要键盘手动输入,极大优化了传统验证码用户体验不佳的问题;同时,快速、准确的返回人机判定结果。目前对外提供两种类型的验证码,其中包含滑动拼图、文字点选。如图1-1、1-2所示。若希望不影响原UI布局,可采用弹出式交互。
* 后端基于Java实现,提供纯Java.jar和SpringBoot Starter。前端提供了Android、iOS、Futter、Uni-App、ReactNative、Vue、Angular、Html、Php等多端示例。
| 滑动拼图 | 文字点选 | |-----------------------------------------------------------------------|-----------------------------------------------------------------| | ![滑动拼图](images/%E6%BB%91%E5%8A%A8%E6%8B%BC%E5%9B%BE.gif "滑动拼图")  | ![点选文字](images/%E7%82%B9%E9%80%89%E6%96%87%E5%AD%97.gif "点选文字") | | 图1-1 | 图1-2 | #### 概念术语描述 | 术语 | 描述 | |-------|---------------------------------------------------------------------| | 验证码类型 | 1)滑动拼图 blockPuzzle 2)文字点选 clickWord | | 验证 | 用户拖动/点击一次验证码拼图即视为一次“验证”,不论拼图/点击是否正确 | | 二次校验 | 验证数据随表单提交到后台后,后台需要调用captchaService.verification做二次校验。目的是核实验证数据的有效性。 | ### 交互流程 ① 用户访问应用页面,请求显示行为验证码
② 用户按照提示要求完成验证码拼图/点击
③ 用户提交表单,前端将第二步的输出一同提交到后台
④ 验证数据随表单提交到后台后,后台需要调用captchaService.verification做二次校验。
⑤ 第4步返回校验通过/失败到产品应用后端,再返回到前端。如下图所示。 ![时序图](view/vue/static/shixu.png "时序图") ### 目录结构 ``` ├─core │ ├─captcha-plus java核心源码 │ └─spring-boot-starter-captcha-plus springboot快速启动 ├─demo │ ├─springboot springboot2接口实现示例 │ ├─springboot3 springboot3接实现示例 ├─images 效果图 └─view 多语言客户端示例 ├─android 原生android实现示例 ├─angular angular实现示例 ├─flutter flutter实现示例 ├─html 原生html实现示例 ├─ios 原生ios实现示例 ├─php php实现示例 ├─react react实现示例 ├─uni-app uni-app实现示例 ├─wx-applet 微信小程序实现示例 └─vue vue实现示例 ``` ### 如有问题,请提交[Issue](https://gitee.com/xingyuv/captcha-plus/issues) #### 开源不易,劳烦各位star ☺ ### 谁在用 - [ruoyi-vue-pro](https://gitee.com/zhijiantianya/ruoyi-vue-pro)