c0865b82a0
Show chat on mobile view of server overview basic authentication switched to extreme-ip-lookup for ip lookups (SSL)
72 lines
2.3 KiB
C#
72 lines
2.3 KiB
C#
using System;
|
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace WebfrontCore
|
|
{
|
|
public class Startup
|
|
{
|
|
public Startup(IHostingEnvironment env)
|
|
{
|
|
var builder = new ConfigurationBuilder()
|
|
.SetBasePath(env.ContentRootPath)
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
|
.AddEnvironmentVariables();
|
|
Configuration = builder.Build();
|
|
|
|
if (!IW4MAdmin.Program.Start())
|
|
Environment.Exit(-1);
|
|
}
|
|
|
|
public static IConfigurationRoot Configuration { get; private set; }
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
// Add framework services.
|
|
services.AddMvc();
|
|
}
|
|
|
|
// 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)
|
|
{
|
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
|
loggerFactory.AddDebug();
|
|
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
app.UseBrowserLink();
|
|
}
|
|
else
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
}
|
|
|
|
app.UseStaticFiles();
|
|
|
|
app.UseCookieAuthentication(new CookieAuthenticationOptions()
|
|
{
|
|
AccessDeniedPath = "/Account/Login/",
|
|
AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme,
|
|
AutomaticAuthenticate = true,
|
|
AutomaticChallenge = true,
|
|
LoginPath = "/Account/Login/"
|
|
});
|
|
|
|
app.UseMvc(routes =>
|
|
{
|
|
routes.MapRoute(
|
|
name: "default",
|
|
template: "{controller=Home}/{action=Index}/{id?}");
|
|
});
|
|
|
|
//app.UseBasicAuthentication(Authentication.Basic.Generate());
|
|
}
|
|
}
|
|
}
|