Java Spring Web安全配置适配器是否允许发布?
我想在我的网站上为某个“/接口”URL启用POST请求。我已通过Java Spring Web安全配置适配器是否允许发布?,java,spring,http,Java,Spring,Http,我想在我的网站上为某个“/接口”URL启用POST请求。我已通过class[]getRootConfigClasses()成功加载该类,指定的HttpSecurity http的CSP头存在 每当我向/interface发出请求时,我都会得到HTTP403 @Configuration @EnableWebSecurity public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Over
class[]getRootConfigClasses()
成功加载该类,指定的HttpSecurity http
的CSP头存在
每当我向/interface
发出请求时,我都会得到HTTP403
@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests().antMatchers(HttpMethod.POST, "/interface").permitAll().and()
.headers()
.contentTypeOptions().and()
.cacheControl().and()
.httpStrictTransportSecurity().and()
.frameOptions().and()
.contentSecurityPolicy("the csp header. it is present on every response.");
}
}
尝试重写另一个配置方法:
configure(WebSecurity WebSecurity)
http代码返回的确切消息是什么?
@Override
public void configure(WebSecurity webSecurity) throws Exception {
webSecurity.ignoring().antMatchers(POST, "/interface");
}