azure ad b2cディレクトリのユーザーを照会し、すべてのタイプのユーザーのログインメールをプログラムで抽出します。これは私たちがあることを理解:azureのユーザーを識別する方法b2c
- 標準ユーザー
- ゲストユーザー(B2B)
- ローカルユーザー(メールにサインアップしたB2Cユーザー)
- 社会ユーザー(社会的にサインアップしたB2Cユーザーアカウント)
紺碧の広告グラフエクスプローラを使用してAPI呼び出しを実行している:
https://graph.windows.net/myorganization/users?api-version=1.6
これらのすべてのユーザーを見ることができます。 (データビットを消毒されている)
例Standardユーザ
{
"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": "[email protected]",
"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": [
"[email protected]"
],
"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": "[email protected]"
}
],
"sipProxyAddress": null,
"state": null,
"streetAddress": null,
"surname": "Martin",
"telephoneNumber": null,
"usageLocation": null,
"userIdentities": [],
"userPrincipalName": "[email protected]microsoft.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": [
"[email protected]"
],
"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": "[email protected]ub.onmicrosoft.com",
"userType": "Member"
}
たちは気づく:
標準ユーザー
- userPrincipalNameのは、通常の見える ログイン用メールアドレスを見つけることができ
- :userPrincipalNameの
- 作成タイプは:nu LL
ゲストユーザーのuserPrincipalNameは、ログイン用メールアドレスを見つけることができ
- :otherMails [0]
- 作成タイプは次のとおりです。
ローカルヌルユーザーが
- のuserPrincipalNameは、このプライマリドメイン
- ログイン用メールアドレスに続いて、いくつかのオブジェクトIDになりそうで見つけることができます:signInNames [0]。値
- 作成タイプは次のとおりです。LocalAccount
社会ユーザー
- のuserPrincipalNameは、いくつかのオブジェクトIDに続く「cpim_」は、このプライマリドメイン
- でログイン用メールアドレスを踏襲することが可能になりますで見つかる:otherMails [0]
- 作成タイプ:null
私たちはいくつかの傾向を見ることができますが、推測や悪い仮定をしてはいけません。だから私たちは次の質問を持っています:
1)私たちが見ている4つのタイプのユーザーを知る最も良い方法は何ですか?
2)ログインを簡単にする方法はありますか(理想的には1つのフィールドとして、これを簡単なマッピングにすることを試みています)。その他:
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)ソーシャルユーザーの場合、どのアイデンティティプロバイダが使用されているかを知る最良の方法は何ですか?
UPDATE 11/8:
5)LocalAccountユーザーがotherMail値を得ることはありませんなぜ?
6)LocalAccount以外のユーザーがサインイン名を取得しないのはなぜですか?私はそれがB2C専用に追加されたと思いますか?
7)また、エンドユーザーは今日ソーシャルアカウントとローカルアカウントを関連付ける機能を持っていないと思いますか? (グラフを利用するアプリを使用しない限り)。
UPDATE 11/8#2:
8)は、私が唯一の次の基準を使用して、ソーシャルアカウントでログインすることができますB2C署名アップ個々の曖昧さをなくすことができることを前提とする)今の(それが安全です:
- 作成タイプがある:ヌル - 彼らは
- のuserPrincipalNameは、UUIDが続く「cpim_」が付いているローカルユーザじゃないという意味 - 彼らはおそらく、標準またはゲストユーザーではありません意味
また、より良い方法がありますか?
ありがとうございました!それは、残念ながら、私が期待していた答えでした。要するに、現時点では社会的なアカウントのサインインメールを正しく取得できません。プライマリサインインメールがあるとは思わないでください。 好奇心を抱いた質問: 1)なぜLocalAccountユーザーがotherMail値を取得しないのですか? 2)なぜ非LocalAccountユーザーがサインイン名を取得しないのですか?私はそれがB2C専用に追加されたと思いますか? 3)また、エンドユーザーは今日ソーシャルアカウントとローカルアカウントを関連付ける機能を持っていないと思いますか? (グラフを利用するアプリを使用しない限り)。 ありがとうございました – fei0x
私は元の投稿にあなたの追加の質問を追加しています。これにより、将来のユーザーはこれをより簡単に見ることができます。 –
もう一度おねがいします。これは非常に役に立ちました。私は私の最終的な問題に対処するために、私は最後の質問を1つ追加しました。ありがとうございました – fei0x