spring - 如何在没有 Spring Security 或 Spring Boot 的情况下禁

我们有一个使用 Spring MVC 的 REST API,它不使用 Spring Security 或 Spring Boot。其余 API url 是 {domain}/product/rest/v1/{controller}。我们还有一个使用 Struts2 的常规 Web GUI,它位于 {domain}/product/{action}。

我们目前正在研究使用 Springfox-swagger 和 springfox-swagger-ui 自动生成 API 文档。使用最小配置让 Swagger 工作相当容易,但问题是 Springfox 默认尝试执行 CRSF token 请求,我们不会在其余 API 中使用它。我用谷歌搜索了如何禁用它,但我能找到的每篇文章都在谈论如何使用 Spring Security WebSecurityConfigurationManager 禁用它。我们不使用 Spring Security,也不想添加它。

有没有办法在不使用 Spring Security 或 Spring Boot 的情况下禁用 Springfox Swaggger UI CSRF token 检查?

最佳答案

要禁用 csrf (),您需要在项目中添加 spring 安全性,请点击以下链接如何在 spring 中禁用 csrf()。

https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/csrf.html

关于spring - 如何在没有 Spring Security 或 Spring Boot 的情况下禁用 springfox Swagger UI 的 csrf 保护?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58024176/

相关文章:

c# - Automapper:对所有其他成员使用默认映射

database - 使用扇出写入方法根据隐私设置(PostgreSQL、Redis)更新 Feed

android-management-api - Google Pixel 设备在发出重启命令后重启

node.js - 将参数/通配符定义为 npm 脚本键/名称的一部分

c# - 如何在 ConfigureServices 方法中使用 ASP.NET Core 2.1

reactjs - React - 组件在重新渲染后不更新

firebase - 是否可以为不活动实现自动注销功能?

postgresql - 如何为 linux、Fedora 安装 psycopg2

c# - OmniSharp MSBuild ProjectManager 无法更新我的 .cspr

python - TensorFlow 无法将字符串类型的 Tensor 复制到设备