cf-framework:captcha移到cf-module-system-biz、第三方验证码版本更新升级为com.anji.captcha
@@ -54,7 +54,7 @@
|
|||||||
<!-- Bpm 工作流相关 -->
|
<!-- Bpm 工作流相关 -->
|
||||||
<flowable.version>6.8.0</flowable.version>
|
<flowable.version>6.8.0</flowable.version>
|
||||||
<!-- 工具类相关 -->
|
<!-- 工具类相关 -->
|
||||||
<captcha-plus.version>1.0.8</captcha-plus.version>
|
<anji-plus-captcha.version>1.4.0</anji-plus-captcha.version>
|
||||||
<jsoup.version>1.17.2</jsoup.version>
|
<jsoup.version>1.17.2</jsoup.version>
|
||||||
<lombok.version>1.18.30</lombok.version>
|
<lombok.version>1.18.30</lombok.version>
|
||||||
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
||||||
@@ -604,9 +604,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xingyuv</groupId>
|
<groupId>com.anji-plus</groupId>
|
||||||
<artifactId>spring-boot-starter-captcha-plus</artifactId>
|
<artifactId>captcha-spring-boot-starter</artifactId> <!-- 验证码,一般用于登录使用 -->
|
||||||
<version>${captcha-plus.version}</version>
|
<version>${anji-plus-captcha.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<groupId>com.cf.imes</groupId>
|
|
||||||
<artifactId>cf-framework</artifactId>
|
|
||||||
<version>${revision}</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>cf-spring-boot-starter-captcha</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
|
||||||
<description>验证码拓展
|
|
||||||
1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- Spring 核心 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.xingyuv</groupId>
|
|
||||||
<artifactId>spring-boot-starter-captcha-plus</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Spring 核心 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- DB 相关 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.cf.imes</groupId>
|
|
||||||
<artifactId>cf-spring-boot-starter-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.cf.imes.framework.captcha.config;
|
|
||||||
|
|
||||||
import com.cf.imes.framework.captcha.core.service.RedisCaptchaServiceImpl;
|
|
||||||
import com.xingyuv.captcha.properties.AjCaptchaProperties;
|
|
||||||
import com.xingyuv.captcha.service.CaptchaCacheService;
|
|
||||||
import com.xingyuv.captcha.service.impl.CaptchaServiceFactory;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
@AutoConfiguration
|
|
||||||
public class ChenfengCaptchaConfiguration {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public CaptchaCacheService captchaCacheService(AjCaptchaProperties config) {
|
|
||||||
// 缓存类型 redis/local/....
|
|
||||||
CaptchaCacheService ret = CaptchaServiceFactory.getCache(config.getCacheType().name());
|
|
||||||
if (ret instanceof RedisCaptchaServiceImpl) {
|
|
||||||
((RedisCaptchaServiceImpl) ret).setStringRedisTemplate(stringRedisTemplate);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
com.cf.imes.framework.captcha.core.service.RedisCaptchaServiceImpl
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
com.cf.imes.framework.captcha.config.ChenfengCaptchaConfiguration
|
|
||||||
@@ -154,8 +154,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.anji-plus</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-captcha</artifactId>
|
<artifactId>captcha-spring-boot-starter</artifactId> <!-- 验证码,一般用于登录使用 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -267,10 +267,6 @@
|
|||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
||||||
</include>
|
</include>
|
||||||
<include>
|
|
||||||
<groupId>com.cf.imes</groupId>
|
|
||||||
<artifactId>cf-spring-boot-starter-captcha</artifactId>
|
|
||||||
</include>
|
|
||||||
<include>
|
<include>
|
||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-elasticsearch</artifactId>
|
<artifactId>cf-spring-boot-starter-elasticsearch</artifactId>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.captcha;
|
package com.cf.imes.module.system.controller.admin.captcha;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import com.anji.captcha.model.common.ResponseModel;
|
||||||
|
import com.anji.captcha.model.vo.CaptchaVO;
|
||||||
|
import com.anji.captcha.service.CaptchaService;
|
||||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||||
import com.xingyuv.captcha.model.common.ResponseModel;
|
|
||||||
import com.xingyuv.captcha.model.vo.CaptchaVO;
|
|
||||||
import com.xingyuv.captcha.service.CaptchaService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.cf.imes.module.system.framework.captcha.config;
|
||||||
|
|
||||||
|
import com.anji.captcha.config.AjCaptchaAutoConfiguration;
|
||||||
|
import com.anji.captcha.properties.AjCaptchaProperties;
|
||||||
|
import com.anji.captcha.service.CaptchaCacheService;
|
||||||
|
import com.anji.captcha.service.impl.CaptchaServiceFactory;
|
||||||
|
import com.cf.imes.module.system.framework.captcha.core.RedisCaptchaServiceImpl;
|
||||||
|
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
@ImportAutoConfiguration(AjCaptchaAutoConfiguration.class)
|
||||||
|
public class ChenfengCaptchaConfiguration {
|
||||||
|
|
||||||
|
@Bean(name = "AjCaptchaCacheService")
|
||||||
|
@Primary
|
||||||
|
public CaptchaCacheService captchaCacheService(AjCaptchaProperties config,
|
||||||
|
StringRedisTemplate stringRedisTemplate) {
|
||||||
|
// 缓存类型 redis/local/....
|
||||||
|
CaptchaCacheService captchaCacheService = CaptchaServiceFactory.getCache(config.getCacheType().name());
|
||||||
|
if (captchaCacheService instanceof RedisCaptchaServiceImpl) {
|
||||||
|
((RedisCaptchaServiceImpl) captchaCacheService).setStringRedisTemplate(stringRedisTemplate);
|
||||||
|
}
|
||||||
|
return captchaCacheService;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.cf.imes.framework.captcha.core.service;
|
package com.cf.imes.module.system.framework.captcha.core;
|
||||||
|
|
||||||
import com.xingyuv.captcha.service.CaptchaCacheService;
|
import com.anji.captcha.service.CaptchaCacheService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
@@ -4,4 +4,4 @@
|
|||||||
*
|
*
|
||||||
* @author 星语
|
* @author 星语
|
||||||
*/
|
*/
|
||||||
package com.cf.imes.framework.captcha;
|
package com.cf.imes.module.system.framework.captcha;
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package com.cf.imes.module.system.service.auth;
|
package com.cf.imes.module.system.service.auth;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.anji.captcha.model.common.ResponseModel;
|
||||||
|
import com.anji.captcha.model.vo.CaptchaVO;
|
||||||
|
import com.anji.captcha.service.CaptchaService;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
@@ -36,9 +39,6 @@ import com.cf.imes.module.system.service.organ.OrganService;
|
|||||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.xingyuv.captcha.model.common.ResponseModel;
|
|
||||||
import com.xingyuv.captcha.model.vo.CaptchaVO;
|
|
||||||
import com.xingyuv.captcha.service.CaptchaService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
com.cf.imes.module.system.framework.captcha.core.RedisCaptchaServiceImpl
|
||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@@ -1,6 +1,8 @@
|
|||||||
package com.cf.imes.module.system.service.auth;
|
package com.cf.imes.module.system.service.auth;
|
||||||
|
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
import com.anji.captcha.model.common.ResponseModel;
|
||||||
|
import com.anji.captcha.service.CaptchaService;
|
||||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||||
import com.cf.imes.framework.test.core.ut.BaseDbUnitTest;
|
import com.cf.imes.framework.test.core.ut.BaseDbUnitTest;
|
||||||
@@ -16,8 +18,6 @@ import com.cf.imes.module.system.enums.sms.SmsSceneEnum;
|
|||||||
import com.cf.imes.module.system.service.logger.LoginLogService;
|
import com.cf.imes.module.system.service.logger.LoginLogService;
|
||||||
import com.cf.imes.module.system.service.oauth2.OAuth2TokenService;
|
import com.cf.imes.module.system.service.oauth2.OAuth2TokenService;
|
||||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||||
import com.xingyuv.captcha.model.common.ResponseModel;
|
|
||||||
import com.xingyuv.captcha.service.CaptchaService;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
|||||||