org.apache.velocity
velocity-engine-core
${velocity.version}
diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml
index b0f5702..2da0263 100644
--- a/yudao-framework/pom.xml
+++ b/yudao-framework/pom.xml
@@ -39,6 +39,7 @@
yudao-spring-boot-starter-biz-error-code
yudao-spring-boot-starter-flowable
+ yudao-spring-boot-starter-captcha
yudao-framework
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml b/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml
new file mode 100644
index 0000000..7fc7eb0
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml
@@ -0,0 +1,44 @@
+
+
+
+ cn.iocoder.boot
+ yudao-framework
+ ${revision}
+
+ 4.0.0
+ yudao-spring-boot-starter-captcha
+ jar
+
+ ${project.artifactId}
+
+ 验证码
+
+
+
+
+ cn.iocoder.boot
+ yudao-common
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ cn.iocoder.boot
+ yudao-spring-boot-starter-redis
+
+
+
+
+ com.anji-plus
+ spring-boot-starter-captcha
+
+
+
+
+
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/captcha/core/service/CaptchaServiceImpl.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/captcha/core/service/CaptchaServiceImpl.java
new file mode 100644
index 0000000..c10390e
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/captcha/core/service/CaptchaServiceImpl.java
@@ -0,0 +1,45 @@
+package cn.iocoder.yudao.captcha.core.service;
+
+import com.anji.captcha.service.CaptchaCacheService;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.concurrent.TimeUnit;
+
+@Service
+public class CaptchaServiceImpl implements CaptchaCacheService {
+
+ @Override
+ public String type() {
+ return "redis";
+ }
+
+ @Resource
+ private StringRedisTemplate stringRedisTemplate;
+
+ @Override
+ public void set(String key, String value, long expiresInSeconds) {
+ stringRedisTemplate.opsForValue().set(key, value, expiresInSeconds, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public boolean exists(String key) {
+ return Boolean.TRUE.equals(stringRedisTemplate.hasKey(key));
+ }
+
+ @Override
+ public void delete(String key) {
+ stringRedisTemplate.delete(key);
+ }
+
+ @Override
+ public String get(String key) {
+ return stringRedisTemplate.opsForValue().get(key);
+ }
+
+ @Override
+ public Long increment(String key, long val) {
+ return stringRedisTemplate.opsForValue().increment(key,val);
+ }
+}
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
new file mode 100644
index 0000000..f52c573
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/META-INF/services/com.anji.captcha.service.CaptchaCacheService
@@ -0,0 +1 @@
+cn.iocoder.yudao.captcha.core.service.CaptchaServiceImpl
\ No newline at end of file
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png
new file mode 100644
index 0000000..4cde9dc
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png
new file mode 100644
index 0000000..93b70d4
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png
new file mode 100644
index 0000000..f60f7b7
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png
new file mode 100644
index 0000000..9bd65ef
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png
new file mode 100644
index 0000000..1358506
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png
new file mode 100644
index 0000000..0ea2b37
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png
new file mode 100644
index 0000000..8c05e9c
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png
new file mode 100644
index 0000000..bcd00c7
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png
new file mode 100644
index 0000000..b74f704
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png
new file mode 100644
index 0000000..d6b975b
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png
new file mode 100644
index 0000000..7cec502
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png
new file mode 100644
index 0000000..4f61337
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png
new file mode 100644
index 0000000..a7827fd
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png
new file mode 100644
index 0000000..9f7d813
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png
new file mode 100644
index 0000000..9abec8a
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png
new file mode 100644
index 0000000..3fffdfc
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png
new file mode 100644
index 0000000..f5944a0
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png
new file mode 100644
index 0000000..e17c4fa
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png
new file mode 100644
index 0000000..5d0f909
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png
new file mode 100644
index 0000000..6b39d72
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png
new file mode 100644
index 0000000..3754bee
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png
new file mode 100644
index 0000000..ff36a21
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换.zip b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换.zip
new file mode 100644
index 0000000..b4ead29
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换.zip
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/1.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/1.png
new file mode 100644
index 0000000..369ed87
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/1.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/2.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/2.png
new file mode 100644
index 0000000..adec30f
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/2.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/3.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/3.png
new file mode 100644
index 0000000..6932472
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/3.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/4.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/4.png
new file mode 100644
index 0000000..abfa4fd
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/4.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/5.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/5.png
new file mode 100644
index 0000000..77105ac
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/5.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/6.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/6.png
new file mode 100644
index 0000000..7c90bd7
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/6.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/7.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/7.png
new file mode 100644
index 0000000..9c6862d
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/7.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png
new file mode 100644
index 0000000..b1482d4
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png
new file mode 100644
index 0000000..cdbb0b1
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png
new file mode 100644
index 0000000..bc69c96
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png
new file mode 100644
index 0000000..51573a0
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png
new file mode 100644
index 0000000..f633aee
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png
new file mode 100644
index 0000000..909dc39
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png
new file mode 100644
index 0000000..59bc59c
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png
new file mode 100644
index 0000000..c856f4d
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png
new file mode 100644
index 0000000..4594fcf
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png
new file mode 100644
index 0000000..0f28d82
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png
new file mode 100644
index 0000000..1e04492
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png
new file mode 100644
index 0000000..f11545f
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png
diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png
new file mode 100644
index 0000000..2f3a86d
--- /dev/null
+++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png
diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
index c9a789f..1e75187 100644
--- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
+++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
@@ -81,7 +81,7 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
/**
* 配置 URL 的安全配置
- *
+ *
* anyRequest | 匹配所有请求路径
* access | SpringEl表达式结果为true时可以访问
* anonymous | 匿名可以访问
@@ -109,8 +109,8 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
.headers().frameOptions().disable().and()
// 一堆自定义的 Spring Security 处理器
.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
- .accessDeniedHandler(accessDeniedHandler);
- // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高
+ .accessDeniedHandler(accessDeniedHandler);
+ // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高
// 获得 @PermitAll 带来的 URL 列表,免登录
Multimap permitAllUrls = getPermitAllUrlsFromAnnotations();
@@ -118,23 +118,25 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
httpSecurity
// ①:全局共享规则
.authorizeRequests()
- // 1.1 静态资源,可匿名访问
- .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
- // 1.2 设置 @PermitAll 无需认证
- .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
- .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
- // 1.3 基于 yudao.security.permit-all-urls 无需认证
- .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
- // 1.4 设置 App API 无需认证
- .antMatchers(buildAppApi("/**")).permitAll()
+ // 1.1 静态资源,可匿名访问
+ .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
+ // 1.2 设置 @PermitAll 无需认证
+ .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll()
+ .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
+ // 1.3 基于 yudao.security.permit-all-urls 无需认证
+ .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
+ // 1.4 设置 App API 无需认证
+ .antMatchers(buildAppApi("/**")).permitAll()
+ // 1.5 验证码captcha 允许匿名访问
+ .antMatchers("/captcha/get", "/captcha/check").permitAll()
// ②:每个项目的自定义规则
.and().authorizeRequests(registry -> // 下面,循环设置自定义规则
authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(registry)))
// ③:兜底规则,必须认证
.authorizeRequests()
- .anyRequest().authenticated()
+ .anyRequest().authenticated()
;
// 添加 Token Filter
diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml
index 4dbb097..0963bd7 100644
--- a/yudao-module-system/yudao-module-system-biz/pom.xml
+++ b/yudao-module-system/yudao-module-system-biz/pom.xml
@@ -72,6 +72,11 @@
yudao-spring-boot-starter-redis
+