【问题标题】:Federated identity creation by graph-api in Azure B2C在 Azure B2C 中通过 graph-api 创建联合身份
【发布时间】:2021-12-01 17:34:00
【问题描述】:

在 Azure B2C (https://docs.microsoft.com/en-us/graph/api/user-update?view=graph-rest-1.0&tabs=http) 上使用用户更新 Graph-API,我无法理解如何创建/更新身份结构。

{
    "displayName": "User Name",
    "givenName": "User",
    "surname": "Name",
    "userType": "Member",
    "userPrincipalName": "cpim_uuid@mytenant.onmicrosoft.com",
    ...
    "identities":[
        {
            "signInType" : "federated",
            "issuer": "https://login.company.com/auth/realms/realm-qt
            "issuerAssignedId" : "user.name@company.com"
        },
        {
            "signInType" : "userPrincipalName",
            "issuer": "mytenant.onmicrosoft.com"
            "issuerAssignedId" : "cpim_uuid@mytenant.onmicrosoft.com"
        }
    ]
}

我需要添加一条“signInType”为“federated”的记录,以及其他信息。 示例记录是在首次用户登录时通过与外部 IDP 集成自动创建的。

我想在第一次登录之前在 Azure B2C 上大量创建用户。

【问题讨论】:

标签: azure azure-ad-b2c azure-ad-graph-api idp


【解决方案1】:

• 您可以创建多个“登录类型”为“联合”的用户,如下所示。创建 HTTP 发布请求以传递要创建为联合的用户所需的参数。在下文所述的创建联合用户身份的请求中,按顺序依次提及多个用户的详细信息,如下所示。

  ‘ POST https://graph.microsoft.com/v1.0/users
      Content-type: application/json

  {
       "displayName": "John Smith",
         "identities": [
 {
  "signInType": "userName",
  "issuer": "contoso.onmicrosoft.com",
  "issuerAssignedId": "johnsmith"
},
{
  "signInType": "emailAddress",
  "issuer": "contoso.onmicrosoft.com",
  "issuerAssignedId": "jsmith@yahoo.com"
},
{
  "signInType": "federated",
  "issuer": "facebook.com",
  "issuerAssignedId": "5eecb0cd"
}
],
   "passwordProfile" : {
   "password": "password-value",
    "forceChangePasswordNextSignIn": false
  },
     "passwordPolicies": "DisablePasswordExpiration"
  } ‘

上述请求在图形 API 中的响应如下:-

 ‘ HTTP/1.1 201 Created
    Content-type: application/json

   {
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
       "displayName": "John Smith",
     "id": "4c7be08b-361f-41a8-b1ef-1712f7a3dfb2",
      "identities": [
    {
        "signInType": "userName",
         "issuer": "contoso.onmicrosoft.com",
         "issuerAssignedId": "johnsmith"
      },
     {
         "signInType": "emailAddress",
          "issuer": "contoso.onmicrosoft.com",
          "issuerAssignedId": "jsmith@yahoo.com"
       },
    {
  "signInType": "federated",
  "issuer": "facebook.com",
  "issuerAssignedId": "5eecb0cd"
  }
  ],
     "passwordPolicies": "DisablePasswordExpiration"
  } ‘

详细信息请参考以下链接:-

https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http

另外,请您参考以下 SO 社区线程以获取更多信息:-

How to update identities collection for existing B2C User using Microsoft Graph and SDK

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-10
    • 1970-01-01
    • 2019-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多