通过分配给用户组的App角色来验证Azure AD用户

发布于 2025-01-29 22:28:36 字数 134 浏览 3 评论 0原文

我为Azure AD Backend API创建了一个应用程序角色,并将此角色分配给了一个组。现在,如果用户具有具有此角色的组,我想在我的.NET Core后端应用程序中对用户进行身份验证。我在访问令牌中获得了组ID,但是如何将应用程序角色分配给这些组。

I have created an App role for my AZURE AD Backend Api and assigned this role to a group. Now I want to authenticate user in my .net core backend application on the basis if user has a group which has this role. I am getting the group ids in the access token but how can I get app roles assigned to these groups.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情别恋 2025-02-05 22:28:36

请检查您如何在Azure门户中启用组索赔。

如果您将EMIT组作为角色索赔选项检查,则无法看到应用程序角色,但是您可以看到组ID。

如果启用了上述选项,请确保取消选中框。

note

如果您使用该选项将组数据作为角色发射,则只有小组才能
出现在角色主张中。将用户被分配给的任何应用程序角色都不会出现在角色主张中。

,我建议您在下面参考此Microsoft官方文档, ,然后将应用程序角色分配给该组,Azure AD不会向令牌IT问题添加角色。下图: -

将应用程序角色添加到您的应用程序中,并在令牌中接收它们

“在此处inter

有关更多信息,请详细介绍请参阅>下面的链接:

使用Azure Active Directory 配置应用程序索赔

Please check how you enabled group claims in Azure Portal.

If you check the Emit groups as role claims option like below you cannot see application roles, but you can see group ids.

enter image description here

If the above option is enabled, make sure to uncheck the box.

Note

If you use the option to emit group data as roles, only groups will
appear in the role claim. Any application roles that the user is assigned to won't appear in the role claim.

Also, I would suggest you refer to this Microsoft official documentation below which states that if you add a service principal to a group, and then assign an app role to that group, Azure AD does not add the roles claim to tokens it issues.You can modify the “groupMembershipClaims” field in application manifest if you want to include groups claim in your token like below: -

Add app roles to your application and receive them in the token

enter image description here

For more in detail, please refer below link:

Configure group claims for applications by using Azure Active Directory

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文