java - Spring Security + Scratch Java 扩展

标签 java spring-security scratch-file

为我的 HTTP 请求创建暂存以测试端点,但是由于设置了 Spring Security,我收到了 HTTP/1.1 403 Forbidden

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

谢谢

最佳答案

检查您的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
}

关于java - Spring Security + Scratch Java 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60638681/

相关文章:

java - 在java中对对象数组进行排序

java - Spring-security 甚至在提交表单之前就显示 'Bad Credentials'

Spring Security SAML2(不是 SAML 扩展)- 由于 HttpServerRequest URL 和目标 URL 不匹配导致的身份验证验证异常

java - 在 IDEA Scratch 文件中导入快捷方式

linux - 如何在 Linux 上强制停止 Intellij

java - 封装和模拟

java - 如何在没有继承的情况下避免 DTO 重复?

java - 使用 fxml 和 SceneBuilder 在 JavaFX 中设置全局 CSS 样式表

java - 解密在 Android 设备上加密的字符串

python - 在 PyCharm 中打开一个新的暂存文件?