Beispiel #1
0
        public AppTenantAuthSettingsResolver(AppTenant tenant)
        {
            this.tenant = tenant;

            authSettings = new SimpleAuthSettings();
            authSettings.AuthenticationScheme   = tenant.AuthenticationScheme;
            authSettings.RecaptchaPrivateKey    = tenant.RecaptchaPrivateKey;
            authSettings.RecaptchaPublicKey     = tenant.RecaptchaPublicKey;
            authSettings.EnablePasswordHasherUi = tenant.EnablePasswordHasherUi;
        }
        public SiteAuthSettingsResolver(SiteSettings tenant)
        {
            this.tenant = tenant;

            authSettings = new SimpleAuthSettings();
            authSettings.AuthenticationScheme   = "application";
            authSettings.RecaptchaPrivateKey    = tenant.RecaptchaPrivateKey;
            authSettings.RecaptchaPublicKey     = tenant.RecaptchaPublicKey;
            authSettings.EnablePasswordHasherUi = tenant.EnablePasswordHasherUi;
        }
Beispiel #3
0
        public SiteAuthSettingsResolver(TenantSettings tenant)
        {
            this.tenant = tenant;

            authSettings = new SimpleAuthSettings()
            {
                AuthenticationScheme   = tenant.AuthenticationScheme,
                RecaptchaPrivateKey    = tenant.RecaptchaPrivateKey,
                RecaptchaPublicKey     = tenant.RecaptchaPublicKey,
                EnablePasswordHasherUi = tenant.EnablePasswordHasherUi
            };
        }
Beispiel #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ILoggerFactory loggerFactory,
            IOptions <SimpleAuthSettings> authSettingsAccessor
            )
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());

            app.UseStaticFiles();

            // Add cookie-based authentication to the request pipeline

            SimpleAuthSettings authSettings = authSettingsAccessor.Value;

            var ApplicationCookie = new CookieAuthenticationOptions
            {
                AuthenticationScheme  = authSettings.AuthenticationScheme,
                CookieName            = authSettings.AuthenticationScheme,
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true,
                LoginPath             = new PathString("/Login/Index")
            };

            app.UseCookieAuthentication(ApplicationCookie);


            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }