Beispiel #1
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 key    = context.Request.Query[Constants.TenantQueryStringParam].ToString();
            var tenant = _tenantSearcher.FindByKey(key);

            if (tenant != null && tenant.Active)
            {
                _tenantContext.Set(tenant.Key);
            }
            await next(context);
        }
Beispiel #3
0
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            if (_tenantContext.Resolved)
            {
                await next(context);
            }
            var key = context.Request.Cookies[Constants.TenantCookie];

            if (!string.IsNullOrEmpty(key))
            {
                var tenant = _tenantSearcher.FindByKey(key);
                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);
        }
Beispiel #5
0
 public async Task InvokeAsync(HttpContext context)
 {
     _tenantContext.Set(null);
     await _next(context);
 }