【问题标题】:Is there and Azure AD resource that can be requested in order to get JWT when passing username and password?在传递用户名和密码时,是否可以请求 Azure AD 资源以获取 JWT?
【发布时间】:2015-06-30 06:06:48
【问题描述】:

我有一个多租户应用程序,对于一个单独的本机应用程序,我正在尝试实现NativeClient-Headless-DotNet 描述的类似方法。当我有我的多租户应用程序时,它按预期工作,然后我在 Azure AD 中设置本机客户端应用程序,我将权限添加到 mWeb 应用程序。发出的请求如下所示:

POST https://login.microsoftonline.com/{my tenant id}/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
return-client-request-id: true
x-client-SKU: .NET
x-client-Ver: 2.14.0.0
x-client-CPU: x64
x-client-OS: Microsoft Windows NT 6.2.9200.0    
x-client-last-response-time: 239
x-client-last-endpoint: user_realm
Host: login.microsoftonline.com
Content-Length: 173
Expect: 100-continue

resource={my web app uri id}&client_id={my native client app id}&grant_type=password&username={my username}&password={my password}&scope=openid

非常适合这个原型。我想看看我是否可以在不需要在 Azure AD 中注册本机客户端应用程序的情况下脱身。为此,如果我们假设我可以安全地将用户名和密码传递给我的 Web 应用程序,有没有办法从我的 Web 应用程序而不是我的本机客户端应用程序请求一些资源,它会返回类似于上述请求的响应的响应?比如:

POST https://login.microsoftonline.com/{my tenant id}/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
return-client-request-id: true
x-client-SKU: .NET
x-client-Ver: 2.14.0.0
x-client-CPU: x64
x-client-OS: Microsoft Windows NT 6.2.9200.0    
x-client-last-response-time: 239
x-client-last-endpoint: user_realm
Host: login.microsoftonline.com
Content-Length: 173
Expect: 100-continue

resource={some resource that requires authentication}&client_id={my web app id}&grant_type=password&username={my username}&password={my password}&scope=openid

Azure AD 中有哪些可用的功能?例如,我可以请求 Grap API 令牌,但这需要 client_secret 因为它访问整个目录。我正在寻找可能通过传递用户名和密码来工作的特定配置文件。谢谢。

【问题讨论】:

    标签: authentication oauth-2.0 openid azure-active-directory


    【解决方案1】:

    用户名/密码流程仅供本地客户端使用。 AAD 不提供将用户名/密码传递到您赢得的网站并在那里使用它的机制 - 事实上,强烈建议不要让凭据在通往验证发生的最直接路径之外流通。

    【讨论】:

      猜你喜欢
      • 2021-11-15
      • 2018-12-25
      • 2020-09-09
      • 1970-01-01
      • 2012-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-18
      相关资源
      最近更新 更多