如何在 azure b2c 中识别不同类型的用户
How to identify different kinds of users in azure b2c
我们希望查询 azure ad b2c 目录中的用户,并以编程方式提取所有类型用户的登录电子邮件。我们理解为:
- 标准用户
- 访客用户 (B2B)
- 本地用户(使用电子邮件注册的 B2C 用户)
- 社交用户(注册社交账号的B2C用户)
当 运行 api 使用 azure ad graph explorer 调用时:
https://graph.windows.net/myorganization/users?api-version=1.6
我们可以看到所有这些用户。 (数据被清理了一下)
标准用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "8b7c468b-fec4-4ff2-b448-64f99f3fa9ff",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "Global User",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": null,
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "global.user",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [],
"passwordPolicies": null,
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-10-31T17:20:29Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": null,
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "global.user@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
访客用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "6458e1fc-c27b-40cb-b83d-2124f0999130",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "displayname",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "givenname",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "qa_theaccesshub.com#EXT#",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [
"qa@theaccesshub.com"
],
"passwordPolicies": null,
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-10-31T15:36:22Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "surname",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "qa_theaccesshub.com#EXT#@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
示例本地用户
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "a941e75d-2c1b-4383-9d6c-783c1d008479",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": "LocalAccount",
"department": null,
"dirSyncEnabled": null,
"displayName": "Display Name",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "Glen",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "98c4f2cf-a452-46a4-a33f-6fb451bc3f59",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [],
"passwordPolicies": "DisablePasswordExpiration",
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-11-03T18:18:36Z",
"showInAddressList": null,
"signInNames": [
{
"type": "emailAddress",
"value": "login.email@example.com"
}
],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "Martin",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "98c4f2cf-a452-46a4-a33f-6fb451bc3f59@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
社交用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "917bddd5-40d8-4a25-9a6e-8317a6949b48",
"deletionTimestamp": null,
"accountEnabled": false,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "Display Name",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "GivenName",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "unknown",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [
"another.login.email@example.com"
],
"passwordPolicies": null,
"passwordProfile": {
"password": null,
"forceChangePasswordNextLogin": true,
"enforceChangePasswordPolicy": false
},
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-11-02T13:48:09Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "Surname",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "cpim_662effe2-cd73-4f4a-8b42-2af5f68b2db1@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
总而言之,我们注意到:
标准用户
- userPrincipalName 看起来很正常
- 可以在以下位置找到登录电子邮件:userPrincipalName
- 创建类型为:空
访客用户
- userPrincipalName 看起来是外部目录 upn,后跟“#EXT#”,后跟此主域
- 可以在以下位置找到登录电子邮件:otherMails[0]
- 创建类型为:空
本地用户
- userPrincipalName 看起来是某个对象 ID,后跟此主域
- 可以在以下位置找到登录电子邮件:signInNames[0].value
- 创建类型为:LocalAccount
社交用户
- userPrincipalName 看起来是 'cpim_' 后跟一些对象 ID 后跟此主域
- 可以在以下位置找到登录电子邮件:otherMails[0]
- 创建类型为:空
虽然我们可以看到一些趋势,但我们不想做出猜测或错误的假设。所以我们有以下问题:
1) 了解我们正在关注的四种类型用户中哪一种的最佳方式是什么?
2) 是否有更简单的方法来获取登录名(理想情况下作为一个字段,我们正在尝试将其构建到一个简单的映射中)?除了:
If signInNames[0].value is not null use signInNames[0].value
Elseif otherMails[0] is not null use otherMails[0]
Else userPrincipalName
3) 其他社交用户的行为是否不同? (到目前为止我们只做过 Facebook。)
4) 对于社交用户,了解使用哪个身份提供者的最佳方式是什么?
11 月 8 日更新:
5) 为什么 LocalAccount 用户没有得到 otherMail 值?
6) 为什么非 LocalAccount 用户得不到登录名?我猜那是专为 B2C 添加的?
7) 我猜最终用户现在还没有真正关联社交帐户和本地帐户的能力吗? (除非使用利用图表的应用程序)。
更新 11/8 #2:
8) 假设我可以消除只能使用以下标准使用社交帐户登录的 B2C 注册个人的歧义(现在)是否安全:
- 创建类型为:null - 表示他们不是本地用户
- userPrincipalName 以 'cpim_' 为前缀,后跟 UUID - 这意味着他们可能不是标准或来宾用户
或者有更好的方法吗?
1) 这些不是相互排斥的属性。例如,本地帐户、来宾或会员用户也可以 link 他们的多个社交资料到他们的帐户。基础数据(可通过图表 API 获得)不做任何假设。
了解帐户是否为本地用户的最可靠方法是查看 creationType 属性。您还可以查看 signInNames。话虽如此,但这并不意味着用户将来不会 link 编辑他们的社交资料。只是这个功能没有在 B2C 标准策略中公开。
2) signInNames
当然是用来登录用户的。但是,就目录而言,用户也可以拥有多个 signInName
。这就是为什么 signInNames
是一个集合。因此,公用事业公司或银行的帐户 ID 和电子邮件地址可能都是 signInNames
.
otherMails
不是用于登录用户的 属性。所以你可能想跳过它。将 otherMails
视为目录不用于任何关键功能的电子邮件地址(例如,它不用于登录或密码重置等)
您将 userPrincipalName
用于工作帐户。
3) 所有社交账户都被视为外部用户身份,并以相同的方式映射。它们还不能通过 Graph API 使用,但是当它们可用时,它们也会作为一个集合出现,因为用户可以 link 到多个社交帐户。
4) 今天不可能,但将来会。
更新 11/8 以回答其他问题
5) 仅仅是因为 B2C 标准流程中没有电子邮件地址可以添加到 otherMails
用于本地帐户用户。他们用来注册的电子邮件地址已经在 signInNames
属性 中。通过 Graph API,您可以添加 otherMails
,并且当颁发令牌时,即使对于本地帐户用户,它也会显示在 emails
声明中。
6) 非本地帐户用户不会获得 signInName
,因为他们不需要使用 signInNames
登录。工作帐户改用 userPrincipalName
,它可以绑定到 Office 365、Exchange 或本地 AD。社会 IDP 具有外部身份。因此,至少在今天,还没有 signInNames
需要用于非本地帐户的已知情况。
7) 是的,现在无法通过标准策略 link 将社交帐户与本地帐户关联起来,但可以通过自定义策略来完成。通过 Graph API 也是不可能的(因为外部身份尚未公开),但将来当 API 公开时将是可能的。
11 月 24 日更新:
8) 如果您查看用户主体名称,您会发现它是随机的。 cpim_ 可以随时删除,它不是合同的一部分。事实上,恕我直言,它应该已经被删除,这样应用程序就不会依赖它。
为了正确确定这一点,我们预计会在用户帐户上发布一个新的 "userIdentities" 属性,您可以使用它来确定哪些社交 IDP 是用户帐户 linked到。这将是最好的方法。
您还可以通过 MSOL 请求有关身份提供者的信息:
Get-MsolUser -UserPrincipalName "<userPrincipalName>" | ConvertTo-Json
输出示例
{
"AlternateEmailAddresses": [
"mail@mail.com"
],
"AlternateMobilePhones": [],
"AlternativeSecurityIds": [
{
"ExtensionData": "System.Runtime.Serialization.ExtensionDataObject",
"IdentityProvider": "google.com",
"Key": "49 48 52 56 48 54 51 54 49 55 51 49 55 55 49 57 57 50 54 55 51",
"Type": 6
}
],
"BlockCredential": true,
"City": null,
"CloudExchangeRecipientDisplayType": null,
"Country": null,
"Department": null,
"DirSyncProvisioningErrors": [],
"DisplayName": "User",
"Errors": null,
"ExtensionData": {},
"Fax": null,
"FirstName": null,
"ImmutableId": null,
"IndirectLicenseErrors": [],
"IsBlackberryUser": false,
"IsLicensed": false,
"LastDirSyncTime": null,
"LastName": null,
"LastPasswordChangeTimestamp": "/Date(1511791379000)/",
"LicenseReconciliationNeeded": false,
"Licenses": [],
"LiveId": "10032232271E13BD",
"MSExchRecipientTypeDetails": null,
"MobilePhone": null,
"ObjectId": "6f89d1fb-24be-2231-aaa3-a43d7f75db44",
"Office": null,
"OverallProvisioningStatus": 0,
"PasswordNeverExpires": true,
"PasswordResetNotRequiredDuringActivate": null,
"PhoneNumber": null,
"PortalSettings": null,
"PostalCode": null,
"PreferredLanguage": null,
"ProxyAddresses": [],
"ReleaseTrack": null,
"ServiceInformation": [],
"SignInName": "cpim_96bc77b3-08b2-b3s4-aaa3-b710ae12028e@example.onmicrosoft.com",
"SoftDeletionTimestamp": null,
"State": null,
"StreetAddress": null,
"StrongAuthenticationMethods": [],
"StrongAuthenticationPhoneAppDetails": [],
"StrongAuthenticationProofupTime": null,
"StrongAuthenticationRequirements": [],
"StrongAuthenticationUserDetails": null,
"StrongPasswordRequired": true,
"StsRefreshTokensValidFrom": "/Date(1511791379000)/",
"Title": null,
"UsageLocation": null,
"UserLandingPageIdentifierForO365Shell": null,
"UserPrincipalName": "cpim_96bc77b3-08b2-b3s4-aaa3-b710ae12028e@example.onmicrosoft.com",
"UserThemeIdentifierForO365Shell": null,
"UserType": 1,
"ValidationStatus": 1,
"WhenCreated": "/Date(1511791381000)/"
}
很遗憾,图 API 不包含带有身份提供商列表的字段 AlternativeSecurityIds
。
我们希望查询 azure ad b2c 目录中的用户,并以编程方式提取所有类型用户的登录电子邮件。我们理解为:
- 标准用户
- 访客用户 (B2B)
- 本地用户(使用电子邮件注册的 B2C 用户)
- 社交用户(注册社交账号的B2C用户)
当 运行 api 使用 azure ad graph explorer 调用时:
https://graph.windows.net/myorganization/users?api-version=1.6
我们可以看到所有这些用户。 (数据被清理了一下)
标准用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "8b7c468b-fec4-4ff2-b448-64f99f3fa9ff",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "Global User",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": null,
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "global.user",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [],
"passwordPolicies": null,
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-10-31T17:20:29Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": null,
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "global.user@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
访客用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "6458e1fc-c27b-40cb-b83d-2124f0999130",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "displayname",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "givenname",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "qa_theaccesshub.com#EXT#",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [
"qa@theaccesshub.com"
],
"passwordPolicies": null,
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-10-31T15:36:22Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "surname",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "qa_theaccesshub.com#EXT#@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
示例本地用户
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "a941e75d-2c1b-4383-9d6c-783c1d008479",
"deletionTimestamp": null,
"accountEnabled": true,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": "LocalAccount",
"department": null,
"dirSyncEnabled": null,
"displayName": "Display Name",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "Glen",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "98c4f2cf-a452-46a4-a33f-6fb451bc3f59",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [],
"passwordPolicies": "DisablePasswordExpiration",
"passwordProfile": null,
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-11-03T18:18:36Z",
"showInAddressList": null,
"signInNames": [
{
"type": "emailAddress",
"value": "login.email@example.com"
}
],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "Martin",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "98c4f2cf-a452-46a4-a33f-6fb451bc3f59@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
社交用户示例
{
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
"objectId": "917bddd5-40d8-4a25-9a6e-8317a6949b48",
"deletionTimestamp": null,
"accountEnabled": false,
"assignedLicenses": [],
"assignedPlans": [],
"city": null,
"companyName": null,
"country": null,
"creationType": null,
"department": null,
"dirSyncEnabled": null,
"displayName": "Display Name",
"employeeId": null,
"facsimileTelephoneNumber": null,
"givenName": "GivenName",
"immutableId": null,
"isCompromised": null,
"jobTitle": null,
"lastDirSyncTime": null,
"mail": null,
"mailNickname": "unknown",
"mobile": null,
"onPremisesDistinguishedName": null,
"onPremisesSecurityIdentifier": null,
"otherMails": [
"another.login.email@example.com"
],
"passwordPolicies": null,
"passwordProfile": {
"password": null,
"forceChangePasswordNextLogin": true,
"enforceChangePasswordPolicy": false
},
"physicalDeliveryOfficeName": null,
"postalCode": null,
"preferredLanguage": null,
"provisionedPlans": [],
"provisioningErrors": [],
"proxyAddresses": [],
"refreshTokensValidFromDateTime": "2017-11-02T13:48:09Z",
"showInAddressList": null,
"signInNames": [],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "Surname",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "cpim_662effe2-cd73-4f4a-8b42-2af5f68b2db1@qa2clientb2ctheaccesshub.onmicrosoft.com",
"userType": "Member"
}
总而言之,我们注意到:
标准用户
- userPrincipalName 看起来很正常
- 可以在以下位置找到登录电子邮件:userPrincipalName
- 创建类型为:空
访客用户
- userPrincipalName 看起来是外部目录 upn,后跟“#EXT#”,后跟此主域
- 可以在以下位置找到登录电子邮件:otherMails[0]
- 创建类型为:空
本地用户
- userPrincipalName 看起来是某个对象 ID,后跟此主域
- 可以在以下位置找到登录电子邮件:signInNames[0].value
- 创建类型为:LocalAccount
社交用户
- userPrincipalName 看起来是 'cpim_' 后跟一些对象 ID 后跟此主域
- 可以在以下位置找到登录电子邮件:otherMails[0]
- 创建类型为:空
虽然我们可以看到一些趋势,但我们不想做出猜测或错误的假设。所以我们有以下问题:
1) 了解我们正在关注的四种类型用户中哪一种的最佳方式是什么?
2) 是否有更简单的方法来获取登录名(理想情况下作为一个字段,我们正在尝试将其构建到一个简单的映射中)?除了:
If signInNames[0].value is not null use signInNames[0].value
Elseif otherMails[0] is not null use otherMails[0]
Else userPrincipalName
3) 其他社交用户的行为是否不同? (到目前为止我们只做过 Facebook。)
4) 对于社交用户,了解使用哪个身份提供者的最佳方式是什么?
11 月 8 日更新:
5) 为什么 LocalAccount 用户没有得到 otherMail 值?
6) 为什么非 LocalAccount 用户得不到登录名?我猜那是专为 B2C 添加的?
7) 我猜最终用户现在还没有真正关联社交帐户和本地帐户的能力吗? (除非使用利用图表的应用程序)。
更新 11/8 #2:
8) 假设我可以消除只能使用以下标准使用社交帐户登录的 B2C 注册个人的歧义(现在)是否安全:
- 创建类型为:null - 表示他们不是本地用户
- userPrincipalName 以 'cpim_' 为前缀,后跟 UUID - 这意味着他们可能不是标准或来宾用户
或者有更好的方法吗?
1) 这些不是相互排斥的属性。例如,本地帐户、来宾或会员用户也可以 link 他们的多个社交资料到他们的帐户。基础数据(可通过图表 API 获得)不做任何假设。
了解帐户是否为本地用户的最可靠方法是查看 creationType 属性。您还可以查看 signInNames。话虽如此,但这并不意味着用户将来不会 link 编辑他们的社交资料。只是这个功能没有在 B2C 标准策略中公开。
2) signInNames
当然是用来登录用户的。但是,就目录而言,用户也可以拥有多个 signInName
。这就是为什么 signInNames
是一个集合。因此,公用事业公司或银行的帐户 ID 和电子邮件地址可能都是 signInNames
.
otherMails
不是用于登录用户的 属性。所以你可能想跳过它。将 otherMails
视为目录不用于任何关键功能的电子邮件地址(例如,它不用于登录或密码重置等)
您将 userPrincipalName
用于工作帐户。
3) 所有社交账户都被视为外部用户身份,并以相同的方式映射。它们还不能通过 Graph API 使用,但是当它们可用时,它们也会作为一个集合出现,因为用户可以 link 到多个社交帐户。
4) 今天不可能,但将来会。
更新 11/8 以回答其他问题
5) 仅仅是因为 B2C 标准流程中没有电子邮件地址可以添加到 otherMails
用于本地帐户用户。他们用来注册的电子邮件地址已经在 signInNames
属性 中。通过 Graph API,您可以添加 otherMails
,并且当颁发令牌时,即使对于本地帐户用户,它也会显示在 emails
声明中。
6) 非本地帐户用户不会获得 signInName
,因为他们不需要使用 signInNames
登录。工作帐户改用 userPrincipalName
,它可以绑定到 Office 365、Exchange 或本地 AD。社会 IDP 具有外部身份。因此,至少在今天,还没有 signInNames
需要用于非本地帐户的已知情况。
7) 是的,现在无法通过标准策略 link 将社交帐户与本地帐户关联起来,但可以通过自定义策略来完成。通过 Graph API 也是不可能的(因为外部身份尚未公开),但将来当 API 公开时将是可能的。
11 月 24 日更新:
8) 如果您查看用户主体名称,您会发现它是随机的。 cpim_ 可以随时删除,它不是合同的一部分。事实上,恕我直言,它应该已经被删除,这样应用程序就不会依赖它。
为了正确确定这一点,我们预计会在用户帐户上发布一个新的 "userIdentities" 属性,您可以使用它来确定哪些社交 IDP 是用户帐户 linked到。这将是最好的方法。
您还可以通过 MSOL 请求有关身份提供者的信息:
Get-MsolUser -UserPrincipalName "<userPrincipalName>" | ConvertTo-Json
输出示例
{
"AlternateEmailAddresses": [
"mail@mail.com"
],
"AlternateMobilePhones": [],
"AlternativeSecurityIds": [
{
"ExtensionData": "System.Runtime.Serialization.ExtensionDataObject",
"IdentityProvider": "google.com",
"Key": "49 48 52 56 48 54 51 54 49 55 51 49 55 55 49 57 57 50 54 55 51",
"Type": 6
}
],
"BlockCredential": true,
"City": null,
"CloudExchangeRecipientDisplayType": null,
"Country": null,
"Department": null,
"DirSyncProvisioningErrors": [],
"DisplayName": "User",
"Errors": null,
"ExtensionData": {},
"Fax": null,
"FirstName": null,
"ImmutableId": null,
"IndirectLicenseErrors": [],
"IsBlackberryUser": false,
"IsLicensed": false,
"LastDirSyncTime": null,
"LastName": null,
"LastPasswordChangeTimestamp": "/Date(1511791379000)/",
"LicenseReconciliationNeeded": false,
"Licenses": [],
"LiveId": "10032232271E13BD",
"MSExchRecipientTypeDetails": null,
"MobilePhone": null,
"ObjectId": "6f89d1fb-24be-2231-aaa3-a43d7f75db44",
"Office": null,
"OverallProvisioningStatus": 0,
"PasswordNeverExpires": true,
"PasswordResetNotRequiredDuringActivate": null,
"PhoneNumber": null,
"PortalSettings": null,
"PostalCode": null,
"PreferredLanguage": null,
"ProxyAddresses": [],
"ReleaseTrack": null,
"ServiceInformation": [],
"SignInName": "cpim_96bc77b3-08b2-b3s4-aaa3-b710ae12028e@example.onmicrosoft.com",
"SoftDeletionTimestamp": null,
"State": null,
"StreetAddress": null,
"StrongAuthenticationMethods": [],
"StrongAuthenticationPhoneAppDetails": [],
"StrongAuthenticationProofupTime": null,
"StrongAuthenticationRequirements": [],
"StrongAuthenticationUserDetails": null,
"StrongPasswordRequired": true,
"StsRefreshTokensValidFrom": "/Date(1511791379000)/",
"Title": null,
"UsageLocation": null,
"UserLandingPageIdentifierForO365Shell": null,
"UserPrincipalName": "cpim_96bc77b3-08b2-b3s4-aaa3-b710ae12028e@example.onmicrosoft.com",
"UserThemeIdentifierForO365Shell": null,
"UserType": 1,
"ValidationStatus": 1,
"WhenCreated": "/Date(1511791381000)/"
}
很遗憾,图 API 不包含带有身份提供商列表的字段 AlternativeSecurityIds
。