Azure AD OAuth 令牌声明 - 为应用程序用户填充 DisplayName 属性

Azure AD OAuth Token Claim - Populate DisplayName attribute for Application Users

当我从 Azure AD 为应用程序用户(使用 client_id 和 client_secret)请求 OAuth 令牌时,目标是正确的资源受众(目标应用程序),我不知道如何让 Azure AD 在 Azure AD 中填充客户端的 DisplayName 属性(主要用于应用程序客户端,但用户也应该工作)的声明。

POST /<tenant_id>/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=<client_id>&resource=<target_aud_app_uri>&client_secret=<client_secret>
{
  "typ": "JWT",
  "alg": "RS256",
  "x5t": "xxx",
  "kid": "xxx"
}.{
  "aud": "<target_aud_app_uri>",
  "iss": "https://sts.windows.net/<tenant_id>/",
  "iat": 1619676176,
  "nbf": 1619676176,
  "exp": 1619680076,
  "aio": "xxx",
  "appid": "<client_id>",
  "appidacr": "1",
  "idp": "https://sts.windows.net/<tenant_id>/",
  "idtyp": "app",
  "oid": "xxx",
  "rh": "xxx",
  "roles": [
    "XXX"
  ],
  "sid": "xxx",
  "sub": "xxx",
  "tenant_ctry": "AU",
  "tenant_region_scope": "OC",
  "tid": "xxx",
  "uti": "xxx",
  "ver": "1.0"
}.[Signature]

在 Azure AD 的目标应用程序配置中,我在 UI 中添加了它允许的所有可选声明,甚至尝试通过清单添加 'display_name' 但它不知道如何拿起它。有办法吗?

这个question之前有人问过。

这在 Microosft.graph 命名空间下是可能的,但不能用于任何自定义应用程序。换句话说,只有 ms 图 api 令牌具有 app_displayname 声明。对于应用自定义api的token,目前无法添加app_displayname声明,至少目前是不可能的。

我建议你提交user voice,我会投给它