简体   繁体   中英

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.

I'm also using the springdoc-openapi library to generate the API documentation. For now I'm hand writing the yaml file to describe the documentation.

I'm looking for help with getting swagger to authenticate with Azure AD so that I can try out the endpoints in the backend.

Is there someway to do this by either editing the yaml file or with the springdoc-openapi library?

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.

You can refer this Document here they have given in steps how to authenticate swagger with azuread.

You can also refer this document for how Setup Swagger to authenticate against Azure Active Directory is provided by devloper community of .net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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