Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ClubTreasurerContext context,
                              RoleManager <AppRole> roleManager, UserManager <AppUser> userManager, IOptions <RCIConfig> rciConfig)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            IdentitySeed.Initialize(context, userManager, rciConfig, roleManager, Configuration).Wait();

            //TODO: Delete after deployment
            //if (env.IsDevelopment())
            //{
            //    app.Use(async (httpContext, next) =>
            //    {
            //        var user = httpContext.User.Identity.Name;
            //        DeveloperLogin(httpContext).Wait();
            //        await next.Invoke();
            //    });
            //}

            app.UseMvc();
        }