我有一个带有 Azure Active Directory 身份验证的 Azure Web 应用程序(使用 adal-Angular 制作);
在我设置的应用程序清单中"groupMembershipClaims": "SecurityGroup"
奇怪的是,有些天,对于一个用户来说,它在 AAD 令牌中没有包含组成员资格 objectId 列表的组声明,而是有一个名为hasgroups
有价值true
.
我可以做点什么吗?
现在,我将检查是否有一个属性或另一个属性,然后调用 GraphAPI 以获得直接组成员资格。
hasGroups=true
如果用户属于则返回“太多的团体”.我不知道确切的阈值是多少(20?200?),但实际上您需要在代码中执行的操作类似于(伪代码):
if (hasGroups)
Call the Graph to inquire:
Either about the full group membership OR
About membership to a particular group
else
Access groups directly from the token
获取用户所属的所有组 https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#GetUsersMemberships:
https://graph.windows.net/myorganization/users/{user_id}/$links/memberOf?api-version
:
https://graph.windows.net/myorganization/users/{user_id}/isMemberOf?api-version
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)