org.apache.velocity
velocity-engine-core
diff --git a/yudao-framework/pom.xml b/yudao-framework/pom.xml
index b0f5702ae4..2da02638dc 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 0000000000..7fc7eb00b8
--- /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 0000000000..c10390e9dc
--- /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 0000000000..f52c573542
--- /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 0000000000..4cde9dc046
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg1.png differ
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 0000000000..93b70d4c46
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg2.png differ
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 0000000000..f60f7b735b
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg3.png differ
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 0000000000..9bd65ef53f
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg4.png differ
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 0000000000..13585062a7
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg5.png differ
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 0000000000..0ea2b377da
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg6.png differ
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 0000000000..8c05e9c339
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg7.png differ
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 0000000000..bcd00c73ce
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg8.png differ
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 0000000000..b74f704c2a
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/original/bg9.png differ
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 0000000000..d6b975b570
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/1.png differ
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 0000000000..7cec5028c1
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/10.png differ
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 0000000000..4f6133786f
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/11.png differ
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 0000000000..a7827fdab5
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/12.png differ
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 0000000000..9f7d813d7e
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/13.png differ
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 0000000000..9abec8a735
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/14.png differ
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 0000000000..3fffdfcd2f
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/15.png differ
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 0000000000..f5944a0dc4
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/16.png differ
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 0000000000..e17c4fa06d
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/17.png differ
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 0000000000..5d0f9097c2
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/18.png differ
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 0000000000..6b39d72d9f
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/19.png differ
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 0000000000..3754bee0e5
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/8.png differ
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 0000000000..ff36a21562
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/9.png differ
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 0000000000..b4ead29ccd
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换.zip differ
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 0000000000..369ed871e7
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/1.png differ
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 0000000000..adec30f913
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/2.png differ
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 0000000000..69324725e7
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/3.png differ
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 0000000000..abfa4fdcde
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/4.png differ
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 0000000000..77105ac5a6
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/5.png differ
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 0000000000..7c90bd7724
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/6.png differ
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 0000000000..9c6862d9ea
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/11/xin替换/7.png differ
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 0000000000..b1482d48b4
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/2.png differ
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 0000000000..cdbb0b18c4
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/3.png differ
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 0000000000..bc69c96224
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/jigsaw/slidingBlock/4.png differ
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 0000000000..51573a0c4e
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg1.png differ
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 0000000000..f633aeed23
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg10.png differ
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 0000000000..909dc39ef6
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg2.png differ
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 0000000000..59bc59c0b4
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg3.png differ
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 0000000000..c856f4d97e
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg4.png differ
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 0000000000..4594fcf65b
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg5.png differ
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 0000000000..0f28d820b4
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg6.png differ
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 0000000000..1e04492979
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg7.png differ
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 0000000000..f11545fd3e
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg8.png differ
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 0000000000..2f3a86dabb
Binary files /dev/null and b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/resources/images/pic-click/bg9.png differ
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 c9a789f414..1e7518787e 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 4dbb0973ce..0963bd77b8 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
+