gaoluyang
5 天以前 6441ad9f4dc3c1b2af1b9dad505c62ff75d69c4e
项目重构
已修改2个文件
15 ■■■■■ 文件已修改
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
@@ -2,6 +2,7 @@
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
@@ -26,6 +27,14 @@
    @Autowired
    private RepeatSubmitInterceptor repeatSubmitInterceptor;
    /** 照片存储路径 */
    @Value("${file.path}")
    private String filePath;
    /** 报告 word 存储路径 */
    @Value("${wordUrl}")
    private String wordUrl;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry)
    {
@@ -33,6 +42,10 @@
        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
                .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
        /** 业务图片(印章等)与报告 word/pdf 的静态访问 */
        registry.addResourceHandler("/img/**").addResourceLocations("file:" + filePath + "/");
        registry.addResourceHandler("/word/**").addResourceLocations("file:" + wordUrl + "/");
        /** swagger配置 */
        registry.addResourceHandler("/swagger-ui/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -102,7 +102,7 @@
                // 对于登录login 注册register 允许匿名访问
                requests.requestMatchers("/login", "/register").permitAll()
                    // 静态资源,可匿名访问
                    .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
                    .requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**", "/img/**", "/word/**").permitAll()
                    .requestMatchers("/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**", "/druid/**").permitAll()
                    // 除上面外的所有请求全部需要鉴权认证
                    .anyRequest().authenticated();