public async Task Invoke(HttpContext context) { var path = context.Request.Path.Value; if (_accessManager.GetAllowedPaths().Contains(path)) { await _next(context); return; } if (_accessManager.IsActivated()) { await _next(context); return; } else { context.Response.StatusCode = (int)HttpStatusCode.Unauthorized; } }