将团队机器人限制在我的组织内 [英] Limit a teams bot to my organization

查看:52
本文介绍了将团队机器人限制在我的组织内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MSFT Bot Framework 构建团队机器人,但我的机器人仅与我的组织相关.实际上,我不希望我的组织之外的任何人能够与它交谈.

I'm using the MSFT Bot Framework to build a team bot but my bot is only relevant to my organization. Actually I don't want anyone outside my organization to be able to talk to it.

我一直在寻找如何将我的机器人限制为特定的 Office 365 组织,但找不到如何操作.我唯一能找到的就是使用对方的用户字符串来查看他们住在哪个组织中.

I've been looking how to limit my bot to a specific Office 365 organization but can't find how to do it. The only thing I can find is using the other party userstring to see in which org they live.

我的问题:有没有办法将我的机器人限制为单个 O365 组织?

My question: Is ther a way to limit my bot to a single O365 organization?

谢谢

布拉姆

推荐答案

已经 2 年了,但没有真正的答案,它突然出现在我的相关列表中 tho...

Its been 2 years but there's no real answer and it popped up in my related list tho...

现在,您可以编写一个简单的中间件来执行租户过滤,如下所示:

These days you can write an easy simple middleware that does the tenant filtering like here:

public static string TenantFilterSettingAny = "#ANY#";

/// <summary>
/// Here are below scenarios - 
///     #Scenario 1 - Reject the Bot If Tenant is configured in web.config and doesn't match with Incoming request tenant
///     #Scenario 2 - Allow Bot for every Tenant if Tenant is not configured in web.config file and default value is #ANY#             
/// </summary>
/// <param name="activity"></param>
/// <param name="currentTenant"></param>
/// <returns></returns>
public static bool RejectMessageBasedOnTenant(IMessageActivity activity, string currentTenant)
{
    if (!String.Equals(ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"], TenantFilterSettingAny))
    {
        //#Scenario 1
        return !string.Equals(ConfigurationManager.AppSettings["OFFICE_365_TENANT_FILTER"], currentTenant);
    }
    else
    {
        //Scenario 2
        return false;
    }
}

它取自 此示例

这篇关于将团队机器人限制在我的组织内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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