mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
feat: captcha-plus 1.0.4
This commit is contained in:
parent
25df1e2ecd
commit
b892a6d2bd
@ -43,7 +43,7 @@
|
|||||||
<!-- Bpm 工作流相关 -->
|
<!-- Bpm 工作流相关 -->
|
||||||
<flowable.version>6.8.0</flowable.version>
|
<flowable.version>6.8.0</flowable.version>
|
||||||
<!-- 工具类相关 -->
|
<!-- 工具类相关 -->
|
||||||
<captcha-plus.version>1.0.2</captcha-plus.version>
|
<captcha-plus.version>1.0.4</captcha-plus.version>
|
||||||
<jsoup.version>1.15.4</jsoup.version>
|
<jsoup.version>1.15.4</jsoup.version>
|
||||||
<lombok.version>1.18.26</lombok.version>
|
<lombok.version>1.18.26</lombok.version>
|
||||||
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
<mapstruct.version>1.5.5.Final</mapstruct.version>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
<minio.version>8.5.2</minio.version>
|
<minio.version>8.5.2</minio.version>
|
||||||
<aliyun-java-sdk-core.version>4.6.3</aliyun-java-sdk-core.version>
|
<aliyun-java-sdk-core.version>4.6.3</aliyun-java-sdk-core.version>
|
||||||
<aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version>
|
<aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version>
|
||||||
<tencentcloud-sdk-java.version>3.1.715</tencentcloud-sdk-java.version>
|
<tencentcloud-sdk-java.version>3.1.758</tencentcloud-sdk-java.version>
|
||||||
<justauth.version>1.4.0</justauth.version>
|
<justauth.version>1.4.0</justauth.version>
|
||||||
<jimureport.version>1.5.6</jimureport.version>
|
<jimureport.version>1.5.6</jimureport.version>
|
||||||
<xercesImpl.version>2.12.2</xercesImpl.version>
|
<xercesImpl.version>2.12.2</xercesImpl.version>
|
||||||
|
@ -3,11 +3,15 @@ package cn.iocoder.yudao.framework.captcha.config;
|
|||||||
import cn.hutool.core.util.ClassUtil;
|
import cn.hutool.core.util.ClassUtil;
|
||||||
import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants;
|
import cn.iocoder.yudao.framework.captcha.core.enums.CaptchaRedisKeyConstants;
|
||||||
import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl;
|
import cn.iocoder.yudao.framework.captcha.core.service.RedisCaptchaServiceImpl;
|
||||||
|
import com.xingyuv.captcha.properties.AjCaptchaProperties;
|
||||||
import com.xingyuv.captcha.service.CaptchaCacheService;
|
import com.xingyuv.captcha.service.CaptchaCacheService;
|
||||||
|
import com.xingyuv.captcha.service.impl.CaptchaServiceFactory;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
public class YudaoCaptchaConfiguration {
|
public class YudaoCaptchaConfiguration {
|
||||||
|
|
||||||
@ -17,9 +21,17 @@ public class YudaoCaptchaConfiguration {
|
|||||||
ClassUtil.loadClass(CaptchaRedisKeyConstants.class.getName());
|
ClassUtil.loadClass(CaptchaRedisKeyConstants.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CaptchaCacheService captchaCacheService(StringRedisTemplate stringRedisTemplate) {
|
public CaptchaCacheService captchaCacheService(AjCaptchaProperties config) {
|
||||||
return new RedisCaptchaServiceImpl(stringRedisTemplate);
|
//缓存类型redis/local/....
|
||||||
|
CaptchaCacheService ret = CaptchaServiceFactory.getCache(config.getCacheType().name());
|
||||||
|
if(ret instanceof RedisCaptchaServiceImpl){
|
||||||
|
((RedisCaptchaServiceImpl)ret).setStringRedisTemplate(stringRedisTemplate);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,10 @@ public class RedisCaptchaServiceImpl implements CaptchaCacheService {
|
|||||||
return "redis";
|
return "redis";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStringRedisTemplate(StringRedisTemplate stringRedisTemplate) {
|
||||||
|
this.stringRedisTemplate = stringRedisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(String key, String value, long expiresInSeconds) {
|
public void set(String key, String value, long expiresInSeconds) {
|
||||||
stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
|
stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
|
||||||
|
Loading…
Reference in New Issue
Block a user