继承 FilterSecurityInterceptor 自定义Spring security 拦截器,
但是每次都拦截了css等静态资源,求教如何设置。
@Override
protected void configure(HttpSecurity http) throws Exception {
http
//.addFilterAfter(getMyFilterSecurityInterceptor(), FilterSecurityInterceptor.class)
.authorizeRequests()
//.mvcMatchers(HttpMethod.DELETE, "/delete/**").hasRole("ADMIN")
//.mvcMatchers(HttpMethod.GET, "/model-**").hasRole("ADMIN")
//任何尚未匹配的URL只需要对用户进行身份验证
.anyRequest().authenticated()
.and()
//登录地址,成功跳转地址,登录失败地址
.formLogin().loginPage("/login")
.defaultSuccessUrl("/", true)
.failureUrl("/login?error")
//授予所有用户以上地址的访问权限
.permitAll();
//设置可以iframe访问
http.headers().frameOptions().sameOrigin();
}
可以再重写下面的方法(不影响你之前写的代码)