# hm-tools-captcha **Repository Path**: hm-tools/hm-tools-captcha ## Basic Information - **Project Name**: hm-tools-captcha - **Description**: 验证码工具 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2018-11-10 - **Last Updated**: 2021-01-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hm-tools-captcha [![Maven Central](https://img.shields.io/maven-central/v/top.hmtools/hm-tools-captcha.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22top.hmtools%22%20AND%20a:%22hm-tools-captcha%22) [![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu) #### 项目介绍 验证码工具 #### 使用说明 1. 引用本jar包 2. 请求controller top.hmtools.captcha.controller.CaptchaController.show() 获取验证码,并将内容存入session 3. top.hmtools.captcha.CaptchaContext.checkCaptcha(String) 校验验证码 4. 或者,通过配置 top.hmtools.captcha.verify.* 相关配置项,使用内置过滤器进行拦截验证。 #### 配置项 ``` top: hmtools: captcha: enabled: true #是否启用本组件:true 是 / false 不是,缺省:是 timeout: 5*60*1000 #验证码有效时长 uri: #获取验证码图片的uri uuid: param-name: #如果前端请求没有使用cookie传送session id,则只能通过uuid来识别请求是否来自同一终端 img: code-length: # 验证码图片中的字符数 height: #验证码图片的高 width: #验证码图片的宽 verify: enabled: true #是否启用过滤器拦截指定http请求并提取验证码进行验证 param-name: #http请求中验证码的变量名称 uris: #要拦截并验证验证码的http请求的URI集合,支持spring ant路径匹配 - /softs/* - /books/* ``` #### 如何使用本组件的快照版本 1. 在自己的私服建立一个快照代理仓库即可。https://oss.sonatype.org/content/repositories/snapshots/ ![如何使用快照版本](/images/howToUseSnapshot.jpg) 2. 将建好的参考纳入公共库 ![如何使用快照版本](/images/howToUseSnapshot-2.jpg)