[英]Disable Spring Security Basic Login - Spring REST web service
在我的SecurityConfig.java中,
@Override
protected void configure(AuthenticationManagerBuilder auth)
throws Exception {
auth.inMemoryAuthentication().withUser("user").password("password")
.roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/**").hasRole("USER")
.anyRequest().anonymous().and().httpBasic();
}
我如何完全禁用Spring Security,以便能够访问我的Web服务而无需输入“user”和“password”?
使用此Spring Security配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().permitAll();
}
请注意,这不会在Spring Security中从请求链中禁用,它只是告诉Spring Security允许所有请求
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.