public void FindsExactHostnameMatch(string host, string key)
        {
            var tenant = tenantSearcher.FindByHostName(host);

            Assert.NotNull(tenant);
            Assert.AreEqual(tenant.Key, key);
        }
Пример #2
0
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            if (_tenantContext.Resolved)
            {
                await next(context);
            }
            var host   = context.Request.Host.Host;
            var tenant = _tenantSearcher.FindByHostName(host);

            if (tenant != null && tenant.Active)
            {
                _tenantContext.Set(tenant.Key);
            }
            await next(context);
        }
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            if (_tenantContext.Resolved)
            {
                await next(context);
            }
            var referrer = context.Request.Headers["Referer"].ToString();

            if (!string.IsNullOrEmpty(referrer))
            {
                var uriReferer = new Uri(referrer);
                var tenant     = _tenantSearcher.FindByHostName(uriReferer.Host);
                if (tenant != null && tenant.Active)
                {
                    _tenantContext.Set(tenant.Key);
                }
            }
            await next(context);
        }