【问题标题】:How to get name from Identity如何从身份中获取名称
【发布时间】:2021-12-14 20:32:15
【问题描述】:

我们正在使用 Azure AD OWIN 在 MVC 应用程序中对用户进行身份验证。

当我需要获取用户名甚至是preferred_username 时,我会查看这些属性。但名称为空。

HttpContext.User.Identity.Name = null

User.Identity.Name = null

但 Identity 下的 Claims 属性包含我需要的值。

如何获取 Identity 下的 Claims 属性值,例如“name”或“preferred_username”?

【问题讨论】:

    标签: azure-active-directory


    【解决方案1】:

    您是否尝试过使用Azure AD attributes? “displayName”可能会起作用。请让我知道这是否有效。

    最好, 詹姆斯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多