首页 > 解决方案 > 如何在 Spring Boot 应用程序中验证 swagger ui 中的 api

问题描述

我已经使用Oauth2(密码流)编写了一个 Spring Boot 应用程序,我希望无需访问令牌即可访问 Swagger UI 中的 API。我怎样才能做到这一点?

标签: javaspring-bootoauth-2.0swagger-uiswagger-2.0

解决方案


您应该允许 Swagger-Ui 相关路径,以便在您的安全配置中执行此操作,请允许这些路径 .antMatchers( "/v2/api-docs", "/swagger-resources", "/swagger-resources/configuration/ui", "/swagger-resources/configuration/security") .permitAll()


推荐阅读