简体   繁体   English

获取 swagger 以使用 Azure AD + spring 启动配置进行身份验证

[英]Get swagger to authenticate with Azure AD + spring boot configuration

I have a spring boot REST service which is protected with Azure AD, so I'm using the Spring Boot Starter for Azure AD.我有一个 spring 引导 REST 服务,它受 Azure AD 保护,所以我使用 Spring 引导启动程序来保护 Azure AD。

I'm also using the springdoc-openapi library to generate the API documentation.我还使用 springdoc-openapi 库生成 API 文档。 For now I'm hand writing the yaml file to describe the documentation.现在我正在手写 yaml 文件来描述文档。

I'm looking for help with getting swagger to authenticate with Azure AD so that I can try out the endpoints in the backend.我正在寻求有关获取 swagger 以使用 Azure AD 进行身份验证的帮助,以便我可以在后端试用端点。

Is there someway to do this by either editing the yaml file or with the springdoc-openapi library?有没有办法通过编辑 yaml 文件或使用 springdoc-openapi 库来做到这一点?

For getting swagger to authenticate with Azure AD you need to create registered two web application one is for webAPI and another is for your swagger.Then you shoukd require Delegated Permissions for your Swagger Web Site to 'Access' your WebAPI.As swagger is in-built configured in the.Net 5.0 template so that we don't need to take care of documenting our APIs in this latest.Net 5.0. For getting swagger to authenticate with Azure AD you need to create registered two web application one is for webAPI and another is for your swagger.Then you shoukd require Delegated Permissions for your Swagger Web Site to 'Access' your WebAPI.As swagger is in-在 .Net 5.0 模板中构建配置,这样我们就不需要在这个最新的 .Net 5.0 中记录我们的 API。

You can refer this Document here they have given in steps how to authenticate swagger with azuread.您可以在此处参考此文档,他们在步骤中给出了如何使用 azuread 对 swagger 进行身份验证。

You can also refer this document for how Setup Swagger to authenticate against Azure Active Directory is provided by devloper community of .net您还可以参考此文档了解如何设置 Swagger 以针对 Azure 进行身份验证 Active Directory.net的开发者社区提供

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM