类 BlockPuzzleCaptchaServiceImpl
java.lang.Object
com.xingyuv.captcha.service.impl.AbstractCaptchaService
com.xingyuv.captcha.service.impl.BlockPuzzleCaptchaServiceImpl
- 所有已实现的接口:
CaptchaService
滑动验证码
Created by raodeming on 2019/12/25.
-
字段概要
从类继承的字段 com.xingyuv.captcha.service.impl.AbstractCaptchaService
cacheType, captchaAesStatus, captchaInterferenceOptions, clickWordFont, clickWordFontStr, 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 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private static intavgMatrix(int[][] matrix) 验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型核对验证码(前端)private static voidcutByTemplate(BufferedImage oriImage, BufferedImage templateImage, BufferedImage newImage, int x, int y) voiddestroy(Properties config) 历史资源清除(过期的图片文件,生成的临时图片...)private static voidfillMatrix(int[][] matrix, int[] values) private static PointVOgenerateJigsawPoint(int originalWidth, int originalHeight, int jigsawWidth, int jigsawHeight) 随机生成拼图坐标获取验证码voidinit(Properties config) 判断应用是否实现了自定义缓存,没有就使用内存private static voidinterferenceByTemplate(BufferedImage oriImage, BufferedImage templateImage, int x, int y) 干扰抠图处理pictureTemplatesCut(BufferedImage originalImage, BufferedImage jigsawImage, String jigsawImageBase64) 根据模板切图private static voidreadPixel(BufferedImage img, int x, int y, int[] pixels) verification(CaptchaVO captchaVO) 二次校验验证码(后端)从类继承的方法 com.xingyuv.captcha.service.impl.AbstractCaptchaService
afterValidateFail, base64StrToImage, decrypt, getCacheService, getEnOrChLength, getValidateClientId, validatedReq
-
构造器详细资料
-
BlockPuzzleCaptchaServiceImpl
public BlockPuzzleCaptchaServiceImpl()
-
-
方法详细资料
-
init
从类复制的说明:AbstractCaptchaService判断应用是否实现了自定义缓存,没有就使用内存- 指定者:
init在接口中CaptchaService- 覆盖:
init在类中AbstractCaptchaService- 参数:
config- config
-
destroy
从接口复制的说明:CaptchaService历史资源清除(过期的图片文件,生成的临时图片...)- 指定者:
destroy在接口中CaptchaService- 覆盖:
destroy在类中AbstractCaptchaService- 参数:
config- 配置项 控制资源清理的粒度
-
captchaType
从接口复制的说明:CaptchaService验证码类型 通过java SPI机制,接入方可自定义实现类,实现新的验证类型- 返回:
- captchaType
-
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
-
pictureTemplatesCut
public CaptchaVO pictureTemplatesCut(BufferedImage originalImage, BufferedImage jigsawImage, String jigsawImageBase64) 根据模板切图- 参数:
originalImage- originalImagejigsawImage- jigsawImagejigsawImageBase64- jigsawImageBase64- 返回:
- CaptchaVO
-
generateJigsawPoint
private static PointVO generateJigsawPoint(int originalWidth, int originalHeight, int jigsawWidth, int jigsawHeight) 随机生成拼图坐标- 参数:
originalWidth- originalWidthoriginalHeight- originalHeightjigsawWidth- jigsawWidthjigsawHeight- jigsawHeight- 返回:
- PointVO
-
cutByTemplate
private static void cutByTemplate(BufferedImage oriImage, BufferedImage templateImage, BufferedImage newImage, int x, int y) - 参数:
oriImage- 原图templateImage- 模板图newImage- 新抠出的小图x- 随机扣取坐标Xy- 随机扣取坐标y
-
interferenceByTemplate
private static void interferenceByTemplate(BufferedImage oriImage, BufferedImage templateImage, int x, int y) 干扰抠图处理- 参数:
oriImage- 原图templateImage- 模板图x- 随机扣取坐标Xy- 随机扣取坐标y
-
readPixel
-
fillMatrix
private static void fillMatrix(int[][] matrix, int[] values) -
avgMatrix
private static int avgMatrix(int[][] matrix)
-