Поделиться через


Using AzureAD Authentication within an Angular Application

A couple of days ago I had a request to provide some feedback regarding what I will consider a good recommendation around using AzureAD Authentication within an Angular Application, basically this team has been using ADAL Library but (for some odd reason, eg some birdie :-) ) they were wondering if that is the best route or is there better alternatives.

Leaving aside the the "benefits" of changing only based on some "hear say", I would like to say first, ADAL definitely works if you want full control over the whole Authentication process including building some of the plumbing.

However, if you are hosting your application inside of Azure App Service Web App you can always leverage the Authentication/Authorization functionality built right into App Service. You can check on this article "Authentication and authorization in Azure App Service" all the details.

This approach allows the developer to pass/delegate control to Azure App Service to take care of all the Authentication needs depending on what is configured. If the application needs to access any Azure AD information, you can then use the Azure AD /.auth/me endpoint via the Angular App, on the following article "Expanding App Service Authentication/Authorization"  you will find all the details you need to know how to extract the relevant claims. Pretty neat, right?

Hope that helps