public class ClickWordCaptchaServiceImpl extends AbstractCaptchaService
Created by raodeming on 2019/12/25.
| 限定符和类型 | 字段和说明 |
|---|---|
protected Font |
clickWordFont |
protected static String |
clickWordFontStr |
private boolean |
fontColorRandom
点选文字 字体颜色是否随机
|
static String |
HAN_ZI |
private int |
wordTotalCount
点选文字 字体总个数
|
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| 构造器和说明 |
|---|
ClickWordCaptchaServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
captchaType()
验证码类型
通过java SPI机制,接入方可自定义实现类,实现新的验证类型
|
ResponseModel |
check(CaptchaVO captchaVO)
核对验证码(前端)
|
void |
destroy(Properties config)
历史资源清除(过期的图片文件,生成的临时图片...)
|
ResponseModel |
get(CaptchaVO captchaVO)
获取验证码
|
private CaptchaVO |
getImageData(BufferedImage backgroundImage) |
private Set<String> |
getRandomWords(int wordCount) |
int |
getWordTotalCount() |
void |
init(Properties config)
判断应用是否实现了自定义缓存,没有就使用内存
|
boolean |
isFontColorRandom() |
private static PointVO |
randomWordPoint(int imageWidth,
int imageHeight,
int wordSortIndex,
int wordCount)
随机字体循环排序下标
|
void |
setFontColorRandom(boolean fontColorRandom) |
void |
setWordTotalCount(int wordTotalCount) |
ResponseModel |
verification(CaptchaVO captchaVO)
二次校验验证码(后端)
|
afterValidateFail, base64StrToImage, decrypt, getCacheService, getEnOrChLength, getValidateClientId, validatedReqpublic static String HAN_ZI
protected static String clickWordFontStr
protected Font clickWordFont
private int wordTotalCount
private boolean fontColorRandom
public String captchaType()
CaptchaServicepublic void init(Properties config)
AbstractCaptchaServiceinit 在接口中 CaptchaServiceinit 在类中 AbstractCaptchaServiceconfig - configpublic void destroy(Properties config)
CaptchaServicedestroy 在接口中 CaptchaServicedestroy 在类中 AbstractCaptchaServiceconfig - 配置项 控制资源清理的粒度public ResponseModel get(CaptchaVO captchaVO)
CaptchaServiceget 在接口中 CaptchaServiceget 在类中 AbstractCaptchaServicepublic ResponseModel check(CaptchaVO captchaVO)
CaptchaServicecheck 在接口中 CaptchaServicecheck 在类中 AbstractCaptchaServicepublic ResponseModel verification(CaptchaVO captchaVO)
CaptchaServiceverification 在接口中 CaptchaServiceverification 在类中 AbstractCaptchaServicepublic int getWordTotalCount()
public void setWordTotalCount(int wordTotalCount)
public boolean isFontColorRandom()
public void setFontColorRandom(boolean fontColorRandom)
private CaptchaVO getImageData(BufferedImage backgroundImage)
private static PointVO randomWordPoint(int imageWidth, int imageHeight, int wordSortIndex, int wordCount)
imageWidth - 图片宽度imageHeight - 图片高度wordSortIndex - 字体循环排序下标(i)wordCount - 字数量Copyright © 2023. All rights reserved.