feat: 优化
This commit is contained in:
@@ -41,6 +41,6 @@ public class GlobalConfig extends WebMvcConfigurationSupport {
|
||||
@Override
|
||||
protected void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new LoginInterceptor())
|
||||
.addPathPatterns("/**").excludePathPatterns("/oauth/**","/system/getConfigByKey","/user/**");
|
||||
.addPathPatterns("/**").excludePathPatterns("/oauth/**","/system/**","/user/**","/ReactRotateCaptcha/**","/sms/**");
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,12 @@
|
||||
package com.schisandra.auth.application.controller;
|
||||
|
||||
import cn.dev33.satoken.secure.SaSecureUtil;
|
||||
import com.schisandra.auth.application.dto.SchisandraCaptchaDTO;
|
||||
import com.schisandra.auth.common.entity.CaptchaResult;
|
||||
import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.common.utils.AESUtils;
|
||||
import com.schisandra.auth.common.utils.RotateImageUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -16,7 +16,6 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.InputStream;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -31,6 +30,9 @@ public class ReactRotateCaptchaController {
|
||||
|
||||
public final String authRotateCaptchaPrefix = "auth.RotateCaptcha";
|
||||
|
||||
@Value("${cipher.salt}")
|
||||
private String salt;
|
||||
|
||||
/**
|
||||
* @description: 获取图片
|
||||
* @param: []
|
||||
@@ -48,8 +50,7 @@ public class ReactRotateCaptchaController {
|
||||
double randomNumber = random.nextInt(280) + 40;
|
||||
InputStream inputStream = ReactRotateCaptchaController.class.getClassLoader().getResourceAsStream("image/test1.jpg");
|
||||
BufferedImage image = ImageIO.read(inputStream);
|
||||
String key = AESUtils.getKey();
|
||||
String token = AESUtils.encrypt(String.valueOf(randomNumber), key);
|
||||
String token = SaSecureUtil.md5BySalt(String.valueOf(randomNumber), salt);
|
||||
String prefix = redisUtil.buildKey(authRotateCaptchaPrefix, token);
|
||||
redisUtil.setNx(prefix, String.valueOf(randomNumber), 60L, TimeUnit.SECONDS);
|
||||
BufferedImage image1 = rotateImageUtils.rotateImage(image, randomNumber, Color.black);
|
||||
|
@@ -94,3 +94,7 @@ mybatis-flex:
|
||||
# 前端地址
|
||||
web:
|
||||
url: http://127.0.0.1:5173/
|
||||
|
||||
# MD5加密salt
|
||||
cipher:
|
||||
salt: E2754BC007CA407190E85DFF6E566003
|
Reference in New Issue
Block a user