【发布时间】:2020-01-21 06:21:45
【问题描述】:
我们有一个使用 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 令牌请求,我们在其余 API 中不使用它。我已经用谷歌搜索了如何禁用它,但我能找到的每一篇文章都谈到了如何使用 Spring Security WebSecurityConfigurationManager 禁用它。我们不使用 Spring Security,也不想添加它。
有没有办法在不使用 Spring Security 或 Spring Boot 的情况下禁用 Springfox Swagger UI CSRF 令牌检查?
【问题讨论】:
-
你确定你没有使用 spring-security 吗?请检查依赖树以确认,也许您的某些依赖项使用了它。
-
@RMachnik 不,我们不使用它。在 Ivy 管理的依赖项列表中的任何地方都找不到 Spring-Security。我们有 aop、bean、context、context-support、core、expression、jcl、oxm、plugin-core、plugin-metadata、test、web 和 webmvc,所有版本均为 5.06(插件为 1.2.0)。 Springfox是core、schema、spi、spring-web、swagger-common、swagger-ui、swagger2,都是2.9.2版本。
标签: spring swagger-ui swagger-2.0 springfox