【问题标题】:Restrict resources access in office 365 during OAuth在 OAuth 期间限制 Office 365 中的资源访问
【发布时间】:2016-09-20 16:22:22
【问题描述】:
我们有一个使用 Azure AD 与 Office 365 进行 OAuth 的 Web 应用程序。我们正试图限制我们可以访问的资源。
示例:身份验证用户可以访问 Site1、Site2 和 Site3。我们只想限制我们的应用程序访问 Site1。有谁知道这是否可能?我尝试查看 Office 365、Azure AD 甚至 Discovery API 文档,但找不到任何有用的信息。
【问题讨论】:
标签:
oauth-2.0
office365
azure-active-directory
【解决方案1】:
您是否还在 Azure AD 上注册了 site1、site2 和 site3?如果我理解正确,我们可以为 site1、site2 和 site 3 配置应用清单来设置如下所示的 require 权限(参考here)
"oauth2Permissions": [
{
"adminConsentDescription": "Allow the application full access to the Todo List service on behalf of the signed-in user",
"adminConsentDisplayName": "Have full access to the Todo List service",
"id": "b69ee3c9-c40d-4f2a-ac80-961cd1534e40",
"isEnabled": true,
"type": "User",
"userConsentDescription": "Allow the application full access to the todo service on your behalf",
"userConsentDisplayName": "Have full access to the todo service",
"value": "user_impersonation"
}
],
然后我们需要将具有正确权限的 Web 应用程序分配为 Microsoft 构建服务,如下图所示:
最后一步是site1、site2、site3需要通过分析access token中的scope来验证请求是否有访问资源的权限。