【问题标题】:Azure AD authentication via REST to an AAD enterprise App通过 REST 对 AAD 企业应用程序进行 Azure AD 身份验证
【发布时间】:2018-09-11 18:39:58
【问题描述】:

我正在使用 ADAL4j 尝试对我们的本地共享点实例(它本身使用 AAD 作为企业应用程序进行身份验证)进行身份验证,以在通过标准流程进入时对用户进行身份验证。

我已将我的消费者 AAD 应用设置为需要“访问 {on prem sharepoint enterprise app}”的权限。然后我向如下所示的 url 发出请求:

https://login.microsoftonline.com/{tenant}/oauth2/authorize?
                      response_type=code&scope=user_impersonation&
                      response_mode=form_post&
                      redirect_uri={uri that is registered in my app}&
                      client_id={my app id}&
                      resource={onprem sharepoint enterprise app id}&
                      state={GUID}&nonce={GUID}

我收到的响应是 401 UNAUTHORIZED:

{
  "error": "invalid_client",
  "error_description": "Invalid audience Uri '{onprem sharepoint enterprise app id}'."
}  

关于这里可能出现什么问题的任何想法?我的搜索并不是很有成效,从逻辑上讲,它似乎应该有效。企业应用程序方面是否有一些设置允许某些客户端访问资源?

感谢您的帮助!

【问题讨论】:

  • 您是否在应用程序中添加了共享点资源 Permissions 它请求访问?可以在 settings 刀片的 Azure 门户中完成。
  • 是的。在应用程序(称为 search-api)中,我启用了对 sharepoint onprem 资源的访问。添加这个之后还有步骤吗?

标签: azure sharepoint azure-active-directory adal adal4j


【解决方案1】:

您应该将resource={onprem sharepoint enterprise app id} 替换为App ID URI of onprem sharepoint enterprise app(安全资源)。详情可参考Oauth 2.0 grant flow

【讨论】:

  • 看起来还是一样的结果:{"error":"invalid_client","error_description":"Invalid Audience Uri 'urn:sharepoint:{hostname of onprem sharepoint}'."} 将采取最好看看链接的页面,看看我是否能找到任何漏洞。
  • 对于新的错误,您应该检查您的 onprem sharepoint 的主机名以确保名称正确。
  • 我已确认 URN 与本地共享点的主机名匹配
  • @Anthony,您能否将资源值替换为 https://graph.windows.net。然后你再试一次。
  • 感谢您的建议,桑尼。这样做之后,我收到以下错误:2018-09-19 11:04:47 DEBUG wire:86 - http-outgoing-1
猜你喜欢
  • 2021-10-25
  • 1970-01-01
  • 1970-01-01
  • 2020-02-01
  • 2021-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-29
相关资源
最近更新 更多