且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在SPA中为Azure AD组授权用户(React JS)

更新时间:2023-02-06 22:35:15

嗨DebOnCloud,


上述步骤是正确的。有关更多信息,请查看以下文档链接:


https://github.com/salvoravida/react-adal  


https://***.com/questions/50305568/how-to-整合-azure-ad-into-a-react-web-app-that-c​​onsume-rest-api-in-azure


我希望这会有所帮助。


谢谢。


We want to authorize User against Azure AD group in SPA (React JS); i.e. User allows to access API from SPA if he/she belongs to a Particular group (e.g. testgroup). Found sample code in Msal.JS.

I'm following

  • Create UserAgentApplication object
  • Call Loginpopup (here graph scope is - "Directory.Read.All")
  • Call acquireTokenSilent (get access token to call MS Graph Api)
  • Call MS Graph to retrieve all AD Groups where User belong to

    Url to get AD Groups - https://graph.microsoft.com/v1.0/me/memberOf

  • After receiving the Ad Groups (user belong to), validating whether User belong to that AD groups ( here - testgroup)

Please suggest me whether I am going in Right direction or any other options are available. Appreciate any sample code on group claims in Azure AD for SPA (react js).

Thanks for your suggestion.

Regards,

Deb

Hi DebOnCloud,

Above mentioned steps are correct. For more information please check the below documentation links:

https://github.com/salvoravida/react-adal 

https://***.com/questions/50305568/how-to-integrate-azure-ad-into-a-react-web-app-that-consumes-a-rest-api-in-azure

I hope this helps.

Thank you.


上一篇 : :如何使用Sql Server部署C#windows应用程序?下一篇 : 如何通过Azure AD检查用户是否在AD组中?

相关阅读

技术问答最新文章