【问题标题】:Is it possible to request only a subset of the scopes for which a user has granted consent in Azure AD OAuth2 implicit flow?是否可以仅请求用户已在 Azure AD OAuth2 隐式流中同意的范围的子集?
【发布时间】:2022-01-19 14:27:39
【问题描述】:

我创建了一个应用注册,我们称之为 API,应用 id URI = api://dummyapi,具有读写范围。 在另一个应用注册的初始请求中,我们称之为客户端,在用户同意令牌的 scp(scope) = "read write" 后,我使用以下请求获得了令牌:

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id={client app id}
&response_type=token
&redirect_uri=http://localhost
&scope=api://dummyapi/read api://dummyapi/write
&response_mode=fragment

对于未来的访问令牌请求,是否可以仅请求读取范围的令牌? 在以只读范围测试以下请求时,我得到了一个 scp = "read write" 的访问令牌。

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id={client app id}
&response_type=token
&redirect_uri=http://localhost
&scope=api://dummyapi/read
&response_mode=fragment

我在考虑这样一种场景,即 UI 客户端应用程序具有只读和读写模式,并且它可以通过 scp=read 请求令牌以实现只读模式。

【问题讨论】:

    标签: azure azure-active-directory


    【解决方案1】:

    我已经在我的环境中测试过。

    https://login.microsoftonline.com/common/oauth2/v2.0/authorize 请求中,我将范围添加为user.read

    但是在生成访问令牌时,结果我得到的范围是 user.read user.readwrite

    由于我的应用注册添加了 user.read user.readwrite 权限,我可能会获得这个范围

    因此,在 Azure AD OAuth2 隐式流中,不能仅请求用户已同意的范围的子集

    【讨论】:

      猜你喜欢
      • 2020-05-12
      • 1970-01-01
      • 2021-06-20
      • 1970-01-01
      • 2016-04-18
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多