From 9344a946adf5287ca7daa4db8cd9c54959fbc3ff Mon Sep 17 00:00:00 2001 From: litianxiang Date: Tue, 2 Dec 2025 15:42:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E5=BC=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/common/security/config/SecurityConfig.java | 10 ++++++++++ .../common/security/filter/AuthenticationFilter.java | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ai/da/common/security/config/SecurityConfig.java b/src/main/java/com/ai/da/common/security/config/SecurityConfig.java index 5473978e..67577e14 100644 --- a/src/main/java/com/ai/da/common/security/config/SecurityConfig.java +++ b/src/main/java/com/ai/da/common/security/config/SecurityConfig.java @@ -18,6 +18,7 @@ import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import jakarta.annotation.Resource; @@ -60,6 +61,15 @@ public class SecurityConfig { httpSecurity .cors(Customizer.withDefaults()) .authorizeHttpRequests(auth -> auth + .requestMatchers( + new AntPathRequestMatcher("/doc.html"), + new AntPathRequestMatcher("/swagger-ui.html"), + new AntPathRequestMatcher("/swagger-ui/**"), + new AntPathRequestMatcher("/swagger-resources/**"), + new AntPathRequestMatcher("/v2/api-docs"), + new AntPathRequestMatcher("/v3/api-docs/**"), + new AntPathRequestMatcher("/webjars/**") + ).permitAll() .requestMatchers(securityProperties.getIgnorePaths()).permitAll() .anyRequest().authenticated() ) diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java index 0c2236e8..726b015a 100644 --- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java +++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java @@ -42,8 +42,11 @@ public class AuthenticationFilter extends OncePerRequestFilter { private SecurityProperties properties; private static final List FILTER_URL = - Arrays.asList("/favicon.ico", "/doc.html", "/api/account/login", "/api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired", - "/webjars/", "/swagger-resources", "/v2/api-docs", "/api/account/resetPwd", + Arrays.asList("/favicon.ico", "/doc.html", "/swagger-ui.html", + "/swagger-resources", "/swagger-resources/", "/swagger-resources/configuration/ui", "/swagger-resources/configuration/security", + "/webjars/", "/v2/api-docs", "/v3/api-docs", "/v3/api-docs/swagger-config", + "/api/account/login", "/api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired", + "/api/account/resetPwd", "/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId", "/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile", "/api/third/party/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew","/api/third/party/updateNoLoginRequiredNew", From a6433389168842adad94d0f778de9156954b4e41 Mon Sep 17 00:00:00 2001 From: litianxiang Date: Tue, 2 Dec 2025 15:43:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E6=8E=A5=E5=8F=A3=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E5=BC=80=E9=97=AE=E9=A2=98pom=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b4d83c3..db8b8b4d 100644 --- a/pom.xml +++ b/pom.xml @@ -135,9 +135,14 @@ com.github.xiaoymin - knife4j-openapi3-spring-boot-starter + knife4j-openapi3-jakarta-spring-boot-starter 4.4.0 + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.3.0 + io.swagger