From 03694f4ed8373a40827d0374611c28c737e01571 Mon Sep 17 00:00:00 2001 From: ms-dev Date: Mon, 14 Jan 2019 18:07:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/mingsoft/config/ShiroConfig.java | 11 +++-- src/main/resources/application.yml | 42 +++++++++---------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/main/java/net/mingsoft/config/ShiroConfig.java b/src/main/java/net/mingsoft/config/ShiroConfig.java index a65bebe4..a6a30e46 100644 --- a/src/main/java/net/mingsoft/config/ShiroConfig.java +++ b/src/main/java/net/mingsoft/config/ShiroConfig.java @@ -22,7 +22,7 @@ import net.mingsoft.basic.security.BaseAuthRealm; @Configuration public class ShiroConfig { - @Value("managerPath") + @Value("${ms.manager.path}") private String managerPath; @Bean @@ -36,12 +36,11 @@ public class ShiroConfig { shiroFilterFactoryBean.setSecurityManager(securityManager); // 拦截器. Map filterChainDefinitionMap = new LinkedHashMap(); - // 配置不会被拦截的链接 顺序判断,因为前端模板采用了thymeleaf,这里不能直接使用 ("/static/**", - // "anon")来配置匿名访问,必须配置到每个静态目录 + // 配置不会被拦截的链接 顺序判断,因为前端模板采用了thymeleaf,这里不能直接使用 ("/static/**", "anon")来配置匿名访问,必须配置到每个静态目录 filterChainDefinitionMap.put("/static/**", "anon"); filterChainDefinitionMap.put("/html/**", "anon"); - filterChainDefinitionMap.put(managerPath+"/ms/checkLogin.do", "anon"); - filterChainDefinitionMap.put(managerPath+"/ms/login.do", "anon"); + filterChainDefinitionMap.put(managerPath+"/checkLogin.do", "anon"); + filterChainDefinitionMap.put(managerPath+"/login.do", "anon"); // 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 filterChainDefinitionMap.put("/logout", "logout"); // :这是一个坑呢,一不小心代码就不好使了; @@ -50,7 +49,7 @@ public class ShiroConfig { // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 shiroFilterFactoryBean.setLoginUrl("/login"); // 登录成功后要跳转的链接 - shiroFilterFactoryBean.setSuccessUrl("/index"); + //shiroFilterFactoryBean.setSuccessUrl("/index"); // 未授权界面; shiroFilterFactoryBean.setUnauthorizedUrl("/403"); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 95d667e9..068432d8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,15 +2,26 @@ server: port: 8081 tomcat: max-http-header-size: 10240 #单位:字节 - ms: - manager: ms - view: - path: /WEB-INF/manager - - -managerPath: /ms - + manager: + path: ms + view: + path: /WEB-INF/manager + session: + timeout: 1800000 #会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms + validation.interval: 120000 #会话清理间隔时间, 单位:毫秒,2m=120000ms + upload: + floder: + path: /upload + file: + denied: exe + allowed: jpg + max: + size: 1 + in: + memory: + size: 4096 + spring: profiles: active: dev @@ -53,10 +64,6 @@ mybatis: configuration: database-id: mysql -session: - timeout: 1800000 #会话超时, 单位:毫秒, 20m=1200000ms, 30m=1800000ms, 60m=3600000ms - validation.interval: 120000 #会话清理间隔时间, 单位:毫秒,2m=120000ms - # slf4j日志配置 logging: # 配置级别 @@ -66,14 +73,3 @@ logging: com.mingsoft: trace -upload: - floder: - path: /upload - file: - denied: exe - allowed: jpg - max: - size: 1 - in: - memory: - size: 4096 \ No newline at end of file