public Task Invoke(HttpContext context) { var options = context.RequestServices.GetRequiredService <IOptions <SessionOptions> >(); var sessionMiddleware = new SessionMiddleware(_next, _loggerFactory, _dataProtectionProvider, _sessionStore, options); return(sessionMiddleware.Invoke(context)); }