public abstract class AbstractCaptchaService extends Object implements CaptchaService
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
cacheType |
protected static Boolean |
captchaAesStatus |
protected static int |
captchaInterferenceOptions |
protected Font |
clickWordFont
点选文字字体
|
protected static String |
clickWordFontStr |
protected static Long |
EXPIRESIN_SECONDS |
protected static Long |
EXPIRESIN_THREE |
protected static int |
HAN_ZI_SIZE |
protected static int |
HAN_ZI_SIZE_HALF |
protected static String |
IMAGE_TYPE_PNG |
private static FrequencyLimitHandler |
limitHandler |
protected org.slf4j.Logger |
logger |
protected static String |
REDIS_CAPTCHA_KEY |
protected static String |
REDIS_SECOND_CAPTCHA_KEY |
protected static String |
slipOffset |
protected static String |
waterMark |
protected Font |
waterMarkFont
水印字体
|
protected static String |
waterMarkFontStr |
| 构造器和说明 |
|---|
AbstractCaptchaService() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterValidateFail(CaptchaVO data) |
static boolean |
base64StrToImage(String imgStr,
String path) |
ResponseModel |
check(CaptchaVO captchaVO)
核对验证码(前端)
|
static String |
decrypt(String point,
String key)
解密前端坐标aes加密
|
void |
destroy(Properties config)
历史资源清除(过期的图片文件,生成的临时图片...)
|
ResponseModel |
get(CaptchaVO captchaVO)
获取验证码
|
protected CaptchaCacheService |
getCacheService(String cacheType) |
protected static int |
getEnOrChLength(String s) |
protected String |
getValidateClientId(CaptchaVO req) |
void |
init(Properties config)
判断应用是否实现了自定义缓存,没有就使用内存
|
private void |
loadWaterMarkFont()
加载resources下的font字体,add by lide1202@hotmail.com
部署在linux中,如果没有安装中文字段,水印和点选文字,中文无法显示,
通过加载resources下的font字体解决,无需在linux中安装字体
|
protected boolean |
validatedReq(ResponseModel resp) |
ResponseModel |
verification(CaptchaVO captchaVO)
二次校验验证码(后端)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcaptchaTypeprotected org.slf4j.Logger logger
protected static int HAN_ZI_SIZE
protected static int HAN_ZI_SIZE_HALF
protected static String REDIS_CAPTCHA_KEY
protected static String REDIS_SECOND_CAPTCHA_KEY
protected static Long EXPIRESIN_SECONDS
protected static Long EXPIRESIN_THREE
protected static String waterMark
protected static String waterMarkFontStr
protected Font waterMarkFont
protected static String slipOffset
protected static Boolean captchaAesStatus
protected static String clickWordFontStr
protected Font clickWordFont
protected static String cacheType
protected static int captchaInterferenceOptions
private static FrequencyLimitHandler limitHandler
public void init(Properties config)
init 在接口中 CaptchaServiceconfig - configprotected CaptchaCacheService getCacheService(String cacheType)
public void destroy(Properties config)
CaptchaServicedestroy 在接口中 CaptchaServiceconfig - 配置项 控制资源清理的粒度public ResponseModel get(CaptchaVO captchaVO)
CaptchaServiceget 在接口中 CaptchaServicepublic ResponseModel check(CaptchaVO captchaVO)
CaptchaServicecheck 在接口中 CaptchaServicepublic ResponseModel verification(CaptchaVO captchaVO)
CaptchaServiceverification 在接口中 CaptchaServiceprotected boolean validatedReq(ResponseModel resp)
protected void afterValidateFail(CaptchaVO data)
private void loadWaterMarkFont()
public static String decrypt(String point, String key) throws Exception
point - 前端坐标key - keyException - Eprotected static int getEnOrChLength(String s)
Copyright © 2023. All rights reserved.