ID-Token、UserInfo 中的 Entra ID 自定义声明

问题描述 投票:0回答:1

使用 Entra ID“自定义声明提供者”似乎可以将声明添加到访问令牌。

https://learn.microsoft.com/en-us/entra/identity-platform/custom-extension-get-started

是否也可以向 ID 令牌和 UserInfo 端点添加声明?

azure-active-directory azure-entra-id
1个回答
0
投票

是的,可以使用 Entra ID“自定义声明提供者”将自定义声明添加到 ID 令牌。但对于

/userinfo
端点,这是不可能的,因为它仅返回 特定 声明。

就我而言,我遵循相同的文档,通过编辑代码创建了一个具有 HTTP 触发器功能的函数应用程序,并获取了其函数 URL:

enter image description here

现在,我配置了一个名为“令牌发布事件”的自定义身份验证扩展,并在此处添加了函数 URL:

enter image description here在 Azure AD 中,我通过启用

隐式流

选项注册了一个应用程序,并在 Manifest

 选项卡中更改了以下属性:

enter image description here现在,我通过添加如下声明来将

自定义声明提供程序

分配给应用程序:

enter image description here在功能应用程序中,我在

Authentication

选项卡中添加了 Microsoft 作为身份提供商:

enter image description here为了测试应用程序,我在浏览器中运行了以下授权请求,并成功获得了

ID token

自定义声明,如下所示: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize?client_id={AppID}&response_type=id_token&redirect_uri=https://jwt.ms&scope=openid&state=12345&nonce=12345

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.