authentication - 如何区分 Microsoft MSA 和 AAD 帐户

标签 authentication azure-active-directory

我们创建了 AAD 和 Live 用户可以登录的融合应用程序。我们想知道拥有 Live 或 AAD 帐户的登录用户。

IdToken/Graph API 中是否有任何 API 或值可用于区分 MSA 或 AAD。

最佳答案

您登录后收到的 Id token 包含 tid 声明中的租户 ID。

例如:

b9419818-09af-49c2-b0c3-653adc1f376e

GUID 是租户的 ID。对于 MSA,该值将为:

9188040d-6c67-4c5b-b112-36a304b66dad

来源:Azure Active Directory v2.0 tokens reference

A GUID that represents the Azure AD tenant that the user is from. For work and school accounts, the GUID is the immutable tenant ID of the organization that the user belongs to. For personal accounts, the value is 9188040d-6c67-4c5b-b112-36a304b66dad. The profile scope is required in order to receive this claim.

您还可以从 iss 声明(即颁发者)获取此 ID。

关于authentication - 如何区分 Microsoft MSA 和 AAD 帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48515074/

相关文章:

c# - 如何使用 MS Graph API 获取组织中的所有部门

azure - 无法在 Azure B2C 注册页面中执行注册属性的重新排序

azure - 我获取 token 的查询有问题吗?

javascript - 用户登录成功后关闭 Activity (WebView)

web-services - Webhook 回调安全

javascript - 将用户散列密码存储在本地存储中?

c# - 无法从 C# 使用 AAD 连接到 Azure SQL 数据库

azure-active-directory - Azure Sql Server 连接字符串不支持关键字 : 'authentication' .

authentication - 如何解决 Android GCM 401 错误?

Laravel - 如何添加全局信息,如\Auth::user()