完成媒体管理模块

This commit is contained in:
ah--desktop
2025-09-14 02:59:36 +08:00
parent ea217caac6
commit 6e710c37c1
42 changed files with 1677 additions and 43 deletions
@@ -20,11 +20,9 @@ import top.xyquan.ecomdmbbackend.utils.JwtUtils;
@EnableWebSecurity
public class SecurityConfig {
private final JwtUtils jwtUtils;
private final JwtAuthenticationFilter jwtAuthenticationFilter;
public SecurityConfig(JwtUtils jwtUtils, JwtAuthenticationFilter jwtAuthenticationFilter) {
this.jwtUtils = jwtUtils;
this.jwtAuthenticationFilter = jwtAuthenticationFilter;
}
@@ -40,6 +38,7 @@ public class SecurityConfig {
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers("/auth/**").permitAll()
.requestMatchers("/uploads/**").permitAll() // 允许直接访问上传的文件
.requestMatchers("/doc.html", "/webjars/**", "/v3/api-docs/**", "/swagger-resources/**",
"/swagger-ui/**", "/swagger-ui.html")
.permitAll()
@@ -18,8 +18,8 @@ public class WebConfig implements WebMvcConfigurer {
.addResourceLocations("classpath:/static/");
// 配置上传文件访问 - 使用绝对路径
registry.addResourceHandler("/static/uploads/**")
.addResourceLocations("file:./static/uploads/");
registry.addResourceHandler("/uploads/**")
.addResourceLocations("file:./uploads/");
// 配置Swagger UI资源
registry.addResourceHandler("/swagger-ui/**")