fix: socket 链接不用经过csrf
This commit is contained in:
parent
511278843d
commit
061966ce36
|
@ -49,11 +49,16 @@ public class ShiroConfig implements EnvironmentAware {
|
|||
Map<String, String> filterChainDefinitionMap = shiroFilterFactoryBean.getFilterChainDefinitionMap();
|
||||
ShiroUtils.loadBaseFilterChain(filterChainDefinitionMap);
|
||||
|
||||
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
|
||||
ignoreCsrfFilter(filterChainDefinitionMap);
|
||||
filterChainDefinitionMap.put("/**", "apikey, csrf, authc");
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
||||
private void ignoreCsrfFilter(Map<String, String> filterChainDefinitionMap) {
|
||||
filterChainDefinitionMap.put("/", "apikey, authc"); // 跳转到 / 不用校验 csrf
|
||||
filterChainDefinitionMap.put("/performance/report/*", "apikey, authc"); // socket 不用校验 csrf
|
||||
}
|
||||
|
||||
@Bean(name = "shiroFilter")
|
||||
public FilterRegistrationBean<Filter> shiroFilter(ShiroFilterFactoryBean shiroFilterFactoryBean) throws Exception {
|
||||
FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
|
||||
|
|
Loading…
Reference in New Issue