如何添加到ID令牌额外要求 - Azure的政府门户(How to add additional

2019-10-28 21:32发布

我试图通过添加额外的要求超载的OAuth ID令牌。 我已经可以使用图形API来获得我需要的权利,但我想知道是否有可能直接添加额外的索赔到ID令牌? 我已经通过添加必需的声明,然后翻转“acceptMappedClaims”到真正的更新清单,但我仍然没有在ID令牌看到这些。 我在想什么?

"optionalClaims": {
    "idToken": [
      {
        "name": "employeeid",
        "source": "user",
        "essential": true,
        "additionalProperties": []
      },
      {
        "name": "mail",
        "source": "user",
        "essential": true,
        "additionalProperties": []
      }
    ],
    "accessToken": [],
    "saml2Token": []
  },
  "acceptMappedClaims": true,

Answer 1:

这取决于其中从生成的ID令牌。 如果是内部部署AD和联合身份使用看一看在ADFS 2016定制OIDC id_token 。

如果它只是一个云身份我想看看发布第二个链接jwmiller5或者这一个: 如何到组索赔-从-ASP净OpenID的连接-owin组件 。

希望这有助于伯尼



Answer 2:

If you are trying to add additional claims into your AD token, you would need Azure AD premium and you can add the values as attributes. See Claim augmentation with Azure AD authentcation

If you just need the claims in one particular application, you can add the claims in the app itself. See Azure AD PostAuthentication add claims



文章来源: How to add additional claims to ID Token - Azure Government Portal