|
|
|
|
@ -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<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>(); |
|
|
|
|
// 配置不会被拦截的链接 顺序判断,因为前端模板采用了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"); |
|
|
|
|
|