类 ClickWordCaptchaServiceImpl
java.lang.Object
com.xingyuv.captcha.service.impl.AbstractCaptchaService
com.xingyuv.captcha.service.impl.ClickWordCaptchaServiceImpl
- 所有已实现的接口:
CaptchaService
点选文字验证码
Created by raodeming on 2019/12/25.
-
字段概要
字段修饰符和类型字段说明protected Fontprotected static Stringprivate boolean点选文字 字体颜色是否随机static Stringprivate int点选文字 字体总个数从类继承的字段 com.xingyuv.captcha.service.impl.AbstractCaptchaService
cacheType, captchaAesStatus, captchaInterferenceOptions, EXPIRESIN_SECONDS, EXPIRESIN_THREE, HAN_ZI_SIZE, HAN_ZI_SIZE_HALF, IMAGE_TYPE_PNG, logger, REDIS_CAPTCHA_KEY, REDIS_SECOND_CAPTCHA_KEY, slipOffset, waterMark, waterMarkFont, waterMarkFontStr -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型核对验证码(前端)voiddestroy(Properties config) 历史资源清除(过期的图片文件,生成的临时图片...)获取验证码private CaptchaVOgetImageData(BufferedImage backgroundImage) getRandomWords(int wordCount) intvoidinit(Properties config) 判断应用是否实现了自定义缓存,没有就使用内存booleanprivate static PointVOrandomWordPoint(int imageWidth, int imageHeight, int wordSortIndex, int wordCount) 随机字体循环排序下标voidsetFontColorRandom(boolean fontColorRandom) voidsetWordTotalCount(int wordTotalCount) verification(CaptchaVO captchaVO) 二次校验验证码(后端)从类继承的方法 com.xingyuv.captcha.service.impl.AbstractCaptchaService
afterValidateFail, base64StrToImage, decrypt, getCacheService, getEnOrChLength, getValidateClientId, validatedReq
-
字段详细资料
-
HAN_ZI
-
clickWordFontStr
-
clickWordFont
-
wordTotalCount
private int wordTotalCount点选文字 字体总个数 -
fontColorRandom
private boolean fontColorRandom点选文字 字体颜色是否随机
-
-
构造器详细资料
-
ClickWordCaptchaServiceImpl
public ClickWordCaptchaServiceImpl()
-
-
方法详细资料
-
captchaType
从接口复制的说明:CaptchaService验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型- 返回:
- captchaType
-
init
从类复制的说明:AbstractCaptchaService判断应用是否实现了自定义缓存,没有就使用内存- 指定者:
init在接口中CaptchaService- 覆盖:
init在类中AbstractCaptchaService- 参数:
config- config
-
destroy
从接口复制的说明:CaptchaService历史资源清除(过期的图片文件,生成的临时图片...)- 指定者:
destroy在接口中CaptchaService- 覆盖:
destroy在类中AbstractCaptchaService- 参数:
config- 配置项 控制资源清理的粒度
-
get
从接口复制的说明:CaptchaService获取验证码- 指定者:
get在接口中CaptchaService- 覆盖:
get在类中AbstractCaptchaService- 参数:
captchaVO- captchaVO- 返回:
- ResponseModel
-
check
从接口复制的说明:CaptchaService核对验证码(前端)- 指定者:
check在接口中CaptchaService- 覆盖:
check在类中AbstractCaptchaService- 参数:
captchaVO- captchaVO- 返回:
- ResponseModel
-
verification
从接口复制的说明:CaptchaService二次校验验证码(后端)- 指定者:
verification在接口中CaptchaService- 覆盖:
verification在类中AbstractCaptchaService- 参数:
captchaVO- captchaVO- 返回:
- ResponseModel
-
getWordTotalCount
public int getWordTotalCount() -
setWordTotalCount
public void setWordTotalCount(int wordTotalCount) -
isFontColorRandom
public boolean isFontColorRandom() -
setFontColorRandom
public void setFontColorRandom(boolean fontColorRandom) -
getImageData
-
getRandomWords
-
randomWordPoint
private static PointVO randomWordPoint(int imageWidth, int imageHeight, int wordSortIndex, int wordCount) 随机字体循环排序下标- 参数:
imageWidth- 图片宽度imageHeight- 图片高度wordSortIndex- 字体循环排序下标(i)wordCount- 字数量- 返回:
- PointVO
-