什么是Windows Azure的AD租户应用程序的OAuth 2.0规范的资源参数 [英] What is the Resource parameter in Windows Azure AD tenant application oAuth 2.0 specification

查看:175
本文介绍了什么是Windows Azure的AD租户应用程序的OAuth 2.0规范的资源参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调用认证过程与使用OAuth 2.0通过使用一个卷曲的Windows Azure AD租户应用程序。但我无法弄清楚什么是在下面的示例code中的参数资源:

 卷曲-X POST https://login.windows.net/<<YOUR--AD-TENANT-ID>>/oauth2/token \\
  -F REDIRECT_URI = HTTP://google.com \\
  -F grant_type = authorization_ code \\
  ** - ˚F资源= HTTPS://management.core.windows.net/ \\ **
  -F CLIENT_ID = 87a544fd -... \\
  -F code = AwABAAAAvPM1 ... 8sSAA


解决方案

资源参数描述了你的客户想要代表用户访问的WebAPI的标识符。在OAuth的最潮涉及4方,资源所有者(即用户),客户端(即应用程序),权威性(又名身份提供者)和资源(又名的WebAPI)。该权威产生访问令牌的受众是资源标识符。

在Azure的AD的情况下,你可以使用客户端ID或资源的WebAPI的应用程序ID URI(在Azure管理门户Azure的AD应用程序的配置选项卡中找到)。举例来说,如果我想我的客户获得令牌访问代表用户的Azure的AD图形API,我会请求一个令牌资源 https://graph.windows.net 。在你的榜样,资源参数值标识的Azure服务管理API。

下面是使用Azure的广告SDK来请求令牌WebAPIs客户端应用程序的一些code样品 - 资源参数的不同用法:


  • 移动应用程序调用的WebAPI:<一href=\"http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_Native\">http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_Native

  • Web应用程序调用的WebAPI:<一href=\"http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_AppToAPI\">http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_AppToAPI

  • 客户端调用图形API:<一href=\"http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_Graph\">http://msdn.microsoft.com/en-us/library/azure/dn646737.aspx#BKMK_Graph

希望这有助于。

I'm trying to invoke an authentication process with a windows Azure AD tenant application using oAuth 2.0 by using curl. But I couldn't figure out what is the parameter "resource' in below sample code:

curl -X POST https://login.windows.net/<<YOUR--AD-TENANT-ID>>/oauth2/token  \
  -F redirect_uri=http://google.com \
  -F grant_type=authorization_code \
  **-F resource=https://management.core.windows.net/ \**
  -F client_id=87a544fd-... \
  -F code=AwABAAAAvPM1...8sSAA

解决方案

Resource parameter depicts the identifier of the WebAPI that your client wants to access on behalf of the user. Most flows in OAuth involve 4 parties, the resource owner (aka user), the client (aka app), the authority (aka identity provider) and the resource (aka webapi). The audience of the access token that the authority generates is the resource identifier.

In the case of Azure AD you can either use the Client ID or the App ID URI of the resource WebAPI (Find them in the configure tab of the Azure AD application in the Azure Management portal). For instance, if I want my client to get a token to access the Azure AD Graph API on behalf of the user, I would request for a token for resource "https://graph.windows.net". In your example, the resource parameter value identifies the Azure Service Management APIs.

Here are some code samples of Client Apps using Azure AD SDKs to request for tokens to WebAPIs - different usages of the resource parameter:

Hope this helps.

这篇关于什么是Windows Azure的AD租户应用程序的OAuth 2.0规范的资源参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆