Azure AD 中 OAuth 应用程序的可选/自定义声明

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

我可以在 Azure AD 中为 OAuth 注册应用程序添加 user.officelocation 声明吗?如果我将其添加到企业应用程序的服务主体中?它会起作用吗?我是否可以在访问令牌中获取用户(同步用户)的办公位置?或者我需要在用户配置文件中配置其他内容(用户属性中的办公位置字段为空)?我的应用程序已授予 user.read.all 范围。

oauth azure-active-directory claims azure-app-registration
1个回答
0
投票

是的,您可以使用 Azure AD 访问令牌来获取用户的办公位置。

Azure AD 应用程序中并更新了清单:

enter image description here

企业申请添加如下声明:

enter image description here

已授予API权限:

enter image description here

我生成了访问令牌并且办公地点声明已成功显示:

https://login.microsoftonline.com/TenantID/oauth2/v2.0/authorize?client_id=ClientID&response_type=token&redirect_uri=https://jwt.ms&scope=api://xxx/claims.read&state=12345&nonce=12345

enter image description here

注意:如果用户没有更新办公地点,则声明不会在访问令牌中返回。

enter image description here

确保办公室位置属性已同步或在用户属性中更新

转到 Azure 门户 -> 用户 -> 编辑属性

enter image description here

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