管理应用程序身份验证操作

应用程序对象的 authenticationBehaviors 属性允许配置与令牌颁发相关的中断性变更行为。 应用程序可以通过启用行为来采用新的中断性变更 (将行为设置为 true) ,或者通过将行为设置为 false) 来禁用它 (来继续使用预先存在的行为。

注意

应用程序对象的 authenticationBehaviors 属性当前仅在 中 beta

读取应用程序的 authenticationBehaviors 设置

authenticationBehaviors 属性仅在请求上$select返回,如下所示。

若要读取租户中所有应用的 属性和其他指定属性,请运行以下示例请求。 请求返回 200 OK 仅显示所选属性的应用程序对象的响应代码和 JSON 表示形式。

GET https://graph.microsoft.com/beta/applications?$select=id,displayName,appId,authenticationBehaviors

若要仅读取单个应用的 authenticationBehaviors 属性,请运行以下示例请求。

GET https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e/authenticationBehaviors

还可以使用 appId 属性,如下所示:

GET https://graph.microsoft.com/beta/applications(appId='37bf1fd4-78b0-4fea-ac2d-6c82829e9365')/authenticationBehaviors

阻止向未经验证的域所有者发出电子邮件声明

如 Microsoft 安全公告Microsoft Entra应用程序中特权提升的潜在风险中所述,应用绝不应将电子邮件声明用于授权目的。 如果应用程序将电子邮件声明用于授权或主要用户标识目的,则会受到帐户和特权提升攻击。 在以下情况下,特别会发现这种未经授权的访问风险:

  • 当用户对象的 mail 属性包含具有未经验证的域所有者的电子邮件地址时
  • 对于多租户应用,其中一个租户中的用户可以通过修改其 邮件 属性来升级其权限以访问另一个租户中的资源

有关在租户中识别这些情况的详细信息,请参阅 迁移,不使用电子邮件声明进行用户标识或授权

目前,默认行为是在声明中删除具有未经验证的域所有者的电子邮件地址,但单租户应用和多租户应用除外,这些应用以前具有未验证电子邮件的登录活动。 如果你的应用属于上述任一例外,并且你想要删除未经验证的电子邮件地址,请将 authenticationBehaviorsremoveUnverifiedEmailClaim 属性设置为 true ,如以下示例所示。 请求会返回 204 No Content 响应代码。

从声明中删除具有未经验证的域所有者的电子邮件地址

选项 1

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e/authenticationBehaviors
Content-Type: application/json

{
    "removeUnverifiedEmailClaim": true
}

选项 2

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e
Content-Type: application/json

{
    "authenticationBehaviors": {
        "removeUnverifiedEmailClaim": true
    }
}

接受声明中未经验证的域所有者的电子邮件地址

选项 1

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e/authenticationBehaviors
Content-Type: application/json

{
    "removeUnverifiedEmailClaim": false
}

选项 2

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e
Content-Type: application/json

{
    "authenticationBehaviors": {
        "removeUnverifiedEmailClaim": false
    }
}

还原默认行为

选项 1

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e/authenticationBehaviors
Content-Type: application/json

{
    "removeUnverifiedEmailClaim": null
}

选项 2

PATCH https://graph.microsoft.com/beta/applications/03ef14b0-ca33-4840-8f4f-d6e91916010e/
Content-Type: application/json

{
    "authenticationBehaviors": {
        "removeUnverifiedEmailClaim": null
    }
}