且构网

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

注册后如何为Azure AD B2C用户设置信息?

更新时间:2023-12-02 13:20:16

开箱即用的AAD B2C SignUp-SignIn用户流未公开任何与安全组相关的功能.

Out-of-the-box AAD B2C SignUp-SignIn user flow does not expose any functionality related to Security Groups.

如果要在B2C中使用组声明,请选择通过自定义(IEF)策略添加一些自定义代码.请参阅此答案

If you want to use group claims in B2C, choose to add some custom code through custom (IEF) policies. See this answer and this post.

为了满足您的要求,您可以使用

In order to achieve your requirements, you could use custom attribute which you have mentioned.

请注意,如果您不希望用户自己设置自定义属性,则无需在"在用户流中使用自定义属性"下的第3步.

Please note that if you don't want the user to set the custom attribute by themselves, you don't need to do this 3rd step under "Use a custom attribute in your user flow":

  1. 选择用户属性,然后选择定制属性(例如,"ShoeSize").点击保存.

创建自定义属性后,可以在MS Graph API中使用自定义属性.

After you create the custom attribute, you can Get the application properties and Using custom attribute with MS Graph API.

使用Microsoft Graph更新用户的自定义属性:

Update the custom attribute for a user with Microsoft Graph:

PATCH https://graph.microsoft.com/v1.0/users/userID

{"extension_831374b3bd5041bfaa54263ec9e050fc_ShoeSize": "123"}

然后,您可以像这样获得令牌中的自定义属性声明:"extension_ShoeSize":"123" .

Then you can get the custom attribute claim in token like this: "extension_ShoeSize": "123".