【发布时间】:2018-12-07 08:09:44
【问题描述】:
我正在使用 Spring 安全库来保护我的应用程序中的 REST api,我现在正在尝试允许访问所有 URL(暂时)但是通过以下配置我发现只允许 GET 请求但不允许 POST 请求(其中我得到 403 禁止响应),我知道下面的第一个 antmatcher 应该同时允许 GET 和 POST,但实际上 2 个 antMatcher 不允许 POST
有人可以告诉我我在这里缺少什么吗?
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
// first I have tried only this antMatcher
.antMatchers("/**").permitAll()
// But then it didn't allow POST even when only using the line below
.antMatchers(HttpMethod.POST, "/**").permitAll()
}
【问题讨论】:
标签: java spring spring-security