在 Azure AD B2C 中定义特定于应用程序的用户角色

Define application specific user roles in Azure AD B2C

我想使用 Azure AD B2C 向在 Asp.Net Core 中编写的 Web API 添加授权。我已经有了身份验证部分,现在我想将 "Roles" 添加到我的应用程序中,例如 "Administrators",并且可能在将来添加更具体的角色。

我已经看到 Azure AD 的示例添加了 "Application roles",但找不到 AD B2C 的任何内容。 Azure 门户中似乎没有任何内容,文档中也没有任何内容。

是否可以向 Azure AD B2C 添加自定义应用程序角色?

Azure AD B2C 目前不支持应用程序角色。您可能希望使用 Azure feedback portal 添加此请求或投票给现有请求。

创建AD groups that you want to function as roles (for instance AppAdministrator) and then override the RolePrinicpal.IsInRole method to check to see whether the user is in that AD group. It provides the same functionality you're looking for. Here's a good rundown explaining how this works: