|
@@ -55,14 +55,27 @@ public class ShiroConfig {
|
|
|
factoryBean.setUnauthorizedUrl("/401");
|
|
factoryBean.setUnauthorizedUrl("/401");
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
- * 自定义url规则
|
|
|
|
|
|
|
+ * 自定义url拦截规则
|
|
|
* http://shiro.apache.org/web.html#urls-
|
|
* http://shiro.apache.org/web.html#urls-
|
|
|
*/
|
|
*/
|
|
|
Map<String, String> filterRuleMap = Maps.newHashMap();
|
|
Map<String, String> filterRuleMap = Maps.newHashMap();
|
|
|
- // 所有请求通过我们自己的JWT Filter
|
|
|
|
|
- filterRuleMap.put("/**", "jwt");
|
|
|
|
|
|
|
+
|
|
|
// 访问401和404页面不通过我们的Filter
|
|
// 访问401和404页面不通过我们的Filter
|
|
|
filterRuleMap.put("/401", "anon");
|
|
filterRuleMap.put("/401", "anon");
|
|
|
|
|
+ //swagger资源不拦截
|
|
|
|
|
+ filterRuleMap.put("/swagger-ui/**", "anon");
|
|
|
|
|
+ filterRuleMap.put("/v2/**","anon");
|
|
|
|
|
+ filterRuleMap.put("/doc.html","anon");
|
|
|
|
|
+ filterRuleMap.put("/webjars/**", "anon");
|
|
|
|
|
+ filterRuleMap.put("/swagger-resources/**", "anon");
|
|
|
|
|
+ filterRuleMap.put("/images/**", "anon");
|
|
|
|
|
+ filterRuleMap.put("/configuration/security", "anon");
|
|
|
|
|
+ filterRuleMap.put("/configuration/ui", "anon");
|
|
|
|
|
+ //登录接口不拦截
|
|
|
|
|
+ filterRuleMap.put("/account/login", "anon");
|
|
|
|
|
+
|
|
|
|
|
+ // 所有请求通过我们自己的JWT Filter
|
|
|
|
|
+ filterRuleMap.put("/**", "jwt");
|
|
|
factoryBean.setFilterChainDefinitionMap(filterRuleMap);
|
|
factoryBean.setFilterChainDefinitionMap(filterRuleMap);
|
|
|
return factoryBean;
|
|
return factoryBean;
|
|
|
}
|
|
}
|