swagger azure ad authentication | web api azure ad authentication | Swagger Azure AD Login

Описание к видео swagger azure ad authentication | web api azure ad authentication | Swagger Azure AD Login

swagger azure ad authentication | web api azure ad authentication | Swagger Azure AD Login | .Net6 Web API Azure AD Authentication
How to integrate Swagger with Azure Active directory(Azure AD) - This swagger azure ad video has the answer. Swagger uses open api specification and we can use it to integrate with any authentication provider like azure ad. For Swagger azure ad login first the application have to be integrated with azure ad authentication to implement swagger azure ad login.

I have used Connected services feature of Visual studio to integrate Web API with Azure AD. It generates Web API Azure AD code, adds required nuget packages, creates azure app registration and configures app settings with swagger azure ad configuration also it creates a default scope access_as_user.

Swagger Azure AD Login requires writing code for AddSecurityDescription, AddSecurityRequirement. AddSecurityDefinition will have content that will be displayed on the Swagger UI. It need .Net6 Web API description, Scopes and also authentication type, Swagger Azure AD Authorization Url, here in this Swagger Azure AD authentication, it is oAuth2.0 and this Swagger Azure AD Login example uses AuthorizationCodeFlow. There are other types of code flows like Password, Implicit, Client Credentials.

Swagger Azure AD Authentication AddSecurityRequirement needed to specify the type of authentication needed, Also it need scopes to be passed.
One last configuration that is needed is to configure the client id.

We need to create another app registration for swagger azure ad authentication and configure the details like client id, swagger azure ad authentication url, swagger azure ad token url and scopes in appsettings.json.

You need to add the swagger azure ad app registration as a client application by going to api's app registration and expose api, add client application. This will ensure that swagger azure active driectory authentication's app registration have access to the api that we have developed.

Once you run swagger azure ad authentication api solution, it will open the swagger UI. you will see an authorize button on the screen. It will open swagger authenticaiton popup, you need to select the scopes. Once you click on swagger authorize button, it will redirect you to azure ad login page. Once you login, it will return the token to Swagger azure ad app which can be used to access the api.

00:00 Swagger Azure Ad Authentication Intro
00:30 Configure Azure AD to Swagger Azure AD App
04:42 Swagger Azure AD login code
10:49 Swagger Azure AD Client App registration
15:40 Swagger Azure AD Authentication app Testing

#SwaggerAzureAD
#WebAPIAzureAD
#SwaggerWebAPIAzureAD

Buy Me A Coffee :
https://www.buymeacoffee.com/azuretea...

GitHub:
https://github.com/AzureTeachNet/Azur...

Комментарии

Информация по комментариям в разработке