From de3b9f5658c4a16e1d20764089db47c24e3f9c81 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期二, 14 四月 2026 16:08:41 +0800
Subject: [PATCH] lsh#

---
 asrs-schedule/src/main/java/com/vincent/rsf/schedule/common/security/SecurityConfig.java |  109 +++---------------------------------------------------
 1 files changed, 6 insertions(+), 103 deletions(-)

diff --git a/asrs-schedule/src/main/java/com/vincent/rsf/schedule/common/security/SecurityConfig.java b/asrs-schedule/src/main/java/com/vincent/rsf/schedule/common/security/SecurityConfig.java
index 952a58f..45e1ef7 100644
--- a/asrs-schedule/src/main/java/com/vincent/rsf/schedule/common/security/SecurityConfig.java
+++ b/asrs-schedule/src/main/java/com/vincent/rsf/schedule/common/security/SecurityConfig.java
@@ -1,125 +1,28 @@
 package com.vincent.rsf.schedule.common.security;
 
-import com.vincent.rsf.schedule.common.constant.Constants;
-import com.vincent.rsf.schedule.common.utils.CommonUtil;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
 import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.AuthenticationEntryPoint;
 import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.security.web.access.AccessDeniedHandler;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import org.springframework.stereotype.Component;
-
-import jakarta.servlet.ServletException;
-import jakarta.servlet.DispatcherType;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import jakarta.annotation.Resource;
-import java.io.IOException;
 
 /**
- * Spring Security閰嶇疆
- *
+ * Spring Security閰嶇疆 - 瀹氭椂浠诲姟妯″潡锛屾斁琛屾墍鏈夎姹�
  */
 @Configuration
 @EnableWebSecurity
-@EnableMethodSecurity(prePostEnabled = true)
 public class SecurityConfig {
 
-    public static final String[] FILTER_PATH = new String[] {
-            "/demo/**",
-            "/test/**",
-            "/system/info",
-            "/tenant/list",
-            "/email/code",
-            "/pda/login",
-            "/erp/**",
-            "/base/**",
-            "/order/**",
-            "/login",
-            "/register",
-            "/druid/**",
-            "/doc.html",
-            "/swagger-ui.html",
-            "/swagger-resources/**",
-            "/webjars/**",
-            "/v2/api-docs/**",
-            "/v3/api-docs/**",
-            "/swagger-ui/**",
-            "/ws/**",
-            "/wcs/**",
-            "/monitor/**",
-            "/ai/mcp/**",
-            "/mcp/**",
-            "/mes/**"
-    };
-
-    @Resource
-    private JwtAccessDeniedHandler jwtAccessDeniedHandler;
-    @Resource
-    private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
-    @Resource
-    private JwtAuthenticationFilter jwtAuthenticationFilter;
-
     @Bean
-    public SecurityFilterChain securityFilterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
-            throws Exception {
-        http.authorizeHttpRequests(authorize -> authorize
-                        .dispatcherTypeMatchers(DispatcherType.ASYNC, DispatcherType.ERROR).permitAll()
-                        .requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
-                        .requestMatchers(HttpMethod.GET, "/file/**", "/captcha", "/", "/config/public/project-logo", "/config/public/project-copyright").permitAll()
-                        .requestMatchers(FILTER_PATH).permitAll()
-                        .anyRequest().authenticated())
+    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+        http.authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll())
                 .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
                 .csrf(csrf -> csrf.disable())
-                .cors(cors -> {
-                })
+                .cors(cors -> {})
                 .logout(logout -> logout.disable())
-                .headers(headers -> headers.frameOptions(frameOptions -> frameOptions.disable()))
-                .exceptionHandling(exceptionHandling -> exceptionHandling
-                        .accessDeniedHandler(jwtAccessDeniedHandler)
-                        .authenticationEntryPoint(jwtAuthenticationEntryPoint))
-                .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
-
+                .headers(headers -> headers.frameOptions(frameOptions -> frameOptions.disable()));
         return http.build();
     }
 
-    // 娌℃湁璁块棶鏉冮檺寮傚父澶勭悊
-    @Component
-    static class JwtAccessDeniedHandler implements AccessDeniedHandler {
-
-        @Override
-        public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e)
-                throws IOException, ServletException {
-            if (response.isCommitted()) {
-                return;
-            }
-            CommonUtil.responseError(response, Constants.UNAUTHORIZED_CODE, Constants.UNAUTHORIZED_MSG, e.getMessage());
-        }
-
-    }
-
-    // 娌℃湁鐧诲綍寮傚父澶勭悊
-    @Component
-    static class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
-
-        @Override
-        public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
-                throws IOException, ServletException {
-            if (response.isCommitted()) {
-                return;
-            }
-            CommonUtil.responseError(response, Constants.UNAUTHENTICATED_CODE, Constants.UNAUTHENTICATED_MSG,
-                    e.getMessage());
-        }
-
-    }
-
 }
-

--
Gitblit v1.9.1