【发布时间】:2017-07-26 20:32:26
【问题描述】:
在ASP.NET Web API 中,我需要能够识别具有唯一ID 的用户,以便可以在另一个数据库中引用他们。所有用户都在Azure Active Directory。我不想要会随着时间而改变的东西 (like a SID)。
我尝试使用 Membership 获取用户 Guid,例如 this,但我发现 Azure Active Directory does not support Memberships。
我发现IdentityExtensions.GetUserId() 是这样使用的:User.Identity.GetUserId()。生成的 id 似乎既不是 Guid 也不是 SID。但是,它似乎对每个用户都是独一无二的。
User.Identity.GetUserId() 可以用来唯一标识 AAD 用户吗?如果没有,正确的做法是什么?
【问题讨论】:
标签: c# asp.net azure active-directory