我的项目要求我使用 Spring Security 进行 CSRF 和 XSS 保护,但不使用它进行身份验证和授权。我已将 SS 配置到我的应用程序中,但每次访问页面时,它都会自动将我重定向到其登录页面。我如何禁用此功能?我的SecurityConfig
文件是:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
}
}
The SecurityConfig
如下所示将允许所有请求不经过身份验证,但将具有 CSRF 和 XSS 防护:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)