【发布时间】:2021-09-23 20:04:50
【问题描述】:
我没有为这个问题找到满意的答案。
我的安全配置到目前为止一直运行良好。
我想再添加一个POST url,所有人都可以访问。
虽然其他排除的网址运行良好,但添加的额外添加的网址不起作用。
我的代码:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors()
.and()
.csrf().disable()
.authorizeRequests()
.antMatchers(HttpMethod.POST, "/ws/**").authenticated()
.antMatchers(HttpMethod.DELETE, "/**").authenticated()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.antMatchers(HttpMethod.GET, "/ws/getEvents").permitAll()// ---> While this is working
.antMatchers(HttpMethod.POST, "/ws/persons/createNotificationsSubscriber*").permitAll()// -->this not working
.anyRequest().authenticated()
.and()
.logout()
.logoutSuccessUrl("http://localhost:3006/eventsMainView")
.and()
.csrf().disable()
.httpBasic();
}
【问题讨论】:
标签: java spring spring-boot spring-security