0

为我的 HTTP 请求创建划痕以测试端点,但是由于设置了 spring 安全性,我得到 HTTP/1.1 403 Forbidden

我该如何解决这个问题,我知道每次运行我的项目时,spring security 都会生成一个新密钥,但是也许有一种方法可以让临时文件获取该密钥或其他东西。

谢谢

4

1 回答 1

1

检查你的WebSecurityConfig班级。我认为您需要像这样配置端点:

protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity.cors();
        httpSecurity.csrf().disable();
        httpSecurity.authorizeRequests()
                .antMatchers(HttpMethod.POST, "/user").permitAll()
                .antMatchers(HttpMethod.POST, "/authenticate").permitAll()
   //some code
}
于 2020-03-11T15:08:51.543 回答