AzureAD 的 OAuthPromptSigniIn 总是默认为 SSO 凭据。如何请求备用的凭证?

问题描述 投票:0回答:1

我为一个客户制作了一个机器人,目的是通过安全的API运行管理命令。

为此,他们需要

  1. 用他们的标准账户登录各队
  2. 当他们执行管理命令时,机器人要求OAuth登录(连接设置为AzureAD v2模式)。
  3. 在门户中的团队测试器中,它从未要求提供凭证,只是默认为已登录的用户。

如何让它始终只要求提供凭证?

一种方法是制作一个单独的AzureAD,但这就需要客户再次支付高级AD,以便能够将为管理API定义的AzureAD角色分配给组,而不是单个用户,所以这不是一个很好的解决方案。

他们也可以添加团队许可证到他们的管理帐户,但这打破了整个工作流程和理由有一个机器人。

我希望这是可能的,否则我超级伤心,一些惊人的管理方案的可能性丢失。不幸的是,我们的企业客户中,没有一家允许使用员工的标准账户来触发各种管理API。

oauth-2.0 azure-active-directory botframework microsoft-teams
1个回答
2
投票

我不知道这是否完全回答了你的问题,我对你想要的东西有点困惑.但根据我的理解,我按照这里的文档。https:/docs.microsoft.comen-usmicrosoftteamsplatformbotshow-toauthenticationadd-authentication?tabs=dotnet%2Cdotnet-sample。

样本中有一个用 azure ad 认证的机器人,每次在团队中都会弹出 azure 登录窗口,出现一个请登录的按钮,然后你点击登录,它就会弹出登录窗口,然后你就可以得到令牌,用它来调用图形等。

我测试了一下,当我和机器人对话时,它总是要求我登录,所以希望这是你要找的东西,如果不是,请说明它缺少哪一部分,谢谢。

编辑:该说明是针对AAD v1端点的,但如果你想使用v2端点,它几乎是一样的,只是需要输入的内容较少,你还需要输入你给api权限的范围,例如 "User.Read User.ReadBasic.All等"。

更新所以经过进一步的讨论,我看到了你的问题所在,你需要做的是,在僵尸频道注册->设置->oauthconnectionsettings中,记下你的数值并删除。

然后创建一个新的,用同样的名字,用这些参数。

service provider: Oauth 2 Generic Provider
ClientID: same as before
secret: same as before. 
scope list delimiter: ' '
authorization URL Template: https://login.microsoftonline.com/common/oauth2/v2.0/authorize   (Replace Common with your tenant, just because i was using common)
Auth URL Query string template (this is key): ?client_id={ClientId}&response_type=code&redirect_uri={RedirectUrl}&scope={Scopes}&state={State}&prompt=login 
token url template: https://login.microsoftonline.com/common/oauth2/v2.0/token (again replace common with your tenant id)
token url query string tempalte : ?
token body template: code={Code}&grant_type=authorization_code&redirect_uri={RedirectUrl}&client_id={ClientId}&client_secret={ClientSecret}
refresh url template: https://login.microsoftonline.com/common/oauth2/v2.0/token  (again replace common with your tenant id)
refresh url query string: ?
refresh body template: refresh_token={RefreshToken}&redirect_uri={RedirectUrl}&grant_type=refresh_token&client_id={ClientId}&client_secret={ClientSecret}
scopes: Mail.Read Mail.Send User.Read User.ReadBasic.All  (or whatever your scopes are) 

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.