diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/config/GlobalConfig.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/config/GlobalConfig.java index 65e09c1..2f0eaa3 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/config/GlobalConfig.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/config/GlobalConfig.java @@ -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/**"); } } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java index 33e9d24..c583946 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java @@ -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); diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml index 940e170..607a86e 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml @@ -93,4 +93,8 @@ mybatis-flex: # 前端地址 web: - url: http://127.0.0.1:5173/ \ No newline at end of file + url: http://127.0.0.1:5173/ + +# MD5加密salt +cipher: + salt: E2754BC007CA407190E85DFF6E566003 \ No newline at end of file