有可能有一个受保护的招摇吗?

Is it possible to have a protected swagger?

我是否需要一个受保护的 swagger 中心,只有应用程序用户可以在其中提出建议并想知道是否可行?

对我来说最好的选择是能够在我的前端应用程序中使用 swagger hub,并且只有登录的用户才能访问此屏幕以及分别由 json 生成的api 在后端

The best option for me would be to be able to have the swagger hub within my front-end

请耐心等待,因为为了清楚起见,其中很多内容都是说明性的。

Swaggerhub 是一种网络服务,您可以在其中托管 Swagger API 文档。它就像 SwaggerUI、Swagger Editor 和 Swagger CodeGen 的组合,但在远程站点上。虽然不准确,但您可以考虑以下 git -> github as swagger -> swaggerhub。所以你不能在你的前端有 swaggerhub。

SwaggerUI 是一个可以在 spring 启动项目中使用的工具,可以直接从您的项目中共享您的 API 信息,这可能正是您想要的。将 spring fox swagger 依赖项添加到项目后,您可以通过访问 http://localhost:8080/your-app-root/swagger-ui/ 查看 Swagger UI,您可以在其中更改它以适合您的服务器地址。

Swaggerhub 提供了控制 swagger 文档隐私的选项。虽然我不认为这正是您想要的,但作为替代方案值得一提。 Check out this short guide from their official documentation.

如果您想在项目中实施 Swagger UI,here's a great guide 甚至包括一些安全配置。通过将 Swagger UI 与 Spring 安全性相结合,您可以托管一个仅供特定登录用户使用的 swagger 页面,具体取决于您的访问策略。