c# – 团队通道1:1上的botframework集成了身份验证AAD
我想在团队频道上连接我的机器人,但我不知道如何确保仅在我们的域(组织)中使用它.
我已经测试了Azure Web App的(身份验证AAD),但它不适用于团队或网络聊天,因为端点不会重定向它. 我有测试来实现AUTH卡,但它不适用于团队. 注意:我正在使用botframework C#api BotBuilder 3.15.2.2 我看其他“问”像: Is it possible to access custom tabs in 1:1 chats in MS Teams? https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/authentication/auth-flow-bot https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/authentication/auth-bot-AAD https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/authentication/authentication https://tsmatz.wordpress.com/2016/09/06/microsoft-bot-framework-bot-with-authentication-and-signin-login/ 此致 编辑: //https://stackoverflow.com/questions/51090597/botframework-on-teams-channel-11-authentication-aad-integrated string tenantIdAAD = ""; try { tenantIdAAD = activity.GetChannelData<TeamsChannelData>().Tenant.Id; } catch (Exception exception) { tenantIdAAD = ""; } ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); if ([AAD_TenantID].TenantIdAAD.Equals(tenantIdAAD) || activity.ServiceUrl.StartsWith("http://localhost") ) { await Conversation.SendAsync(activity,() => new Dialogs.RootDialog().LogIfException()); } else { await connector.Conversations.ReplyToActivityAsync(activity.CreateReply("Access Denied")); } 解决方法
传入消息包含可用于标识用户的信息.消息如下所示:
{ channelData.tenant.id标识用户所属的组织(O365租户),因此您可以查看该组织并拒绝不是您期望的消息. 该消息还具有from.aadObjectId中发件人的AAD对象ID.如果您需要令牌提供给其他服务以便您可以代表用户行事,则上述链接中的身份验证流程非常有用,但如果您需要的只是用户的租户和身份,则该消息可满足您的所有需求. (在信任消息中的任何信息之前,请先记住authenticate the incoming request.) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |