public MultiTenantCookieAuthenticationHandler(
     IDataProtectionProvider dataProtectionProvider,
     MultiTenantCookieOptionsResolverFactory tenantResolverFactory) : base()
 {
     this.dataProtectionProvider = dataProtectionProvider;
     this.tenantResolverFactory  = tenantResolverFactory;
 }
        public MultiTenantCookieAuthenticationMiddleware(
            RequestDelegate next,
            IDataProtectionProvider dataProtectionProvider,
            ILoggerFactory loggerFactory,
            IUrlEncoder urlEncoder,
            IOptions <CookieAuthenticationOptions> options,
            // ConfigureOptions<CookieAuthenticationOptions> configureOptions,
            MultiTenantCookieOptionsResolverFactory tenantResolverFactory
            )
            : base(next, options.Value, loggerFactory, urlEncoder)
        {
            this.dataProtectionProvider = dataProtectionProvider;
            this.tenantResolverFactory  = tenantResolverFactory;
            //this.loggerFactory = loggerFactory;

            if (Options.Events == null)
            {
                Options.Events = new CookieAuthenticationEvents();
            }


            if (string.IsNullOrEmpty(Options.CookieName))
            {
                Options.CookieName = CookieAuthenticationDefaults.CookiePrefix + Options.AuthenticationScheme;
            }

            // we are not actually using this TicketDataFormat
            // we are passing dataProtectionProvider into MultiTenantCookieAuthenticationHandler
            // so it can make tenant specific ticketDataFormat
            if (Options.TicketDataFormat == null)
            {
                var dataProtector = dataProtectionProvider.CreateProtector(
                    typeof(CookieAuthenticationMiddleware).FullName, Options.AuthenticationScheme, "v2");

                Options.TicketDataFormat = new TicketDataFormat(dataProtector);
            }

            if (Options.CookieManager == null)
            {
                Options.CookieManager = new ChunkingCookieManager(urlEncoder);
            }
        }