// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // LiteDB path to store file, for instance: "Data\\Spoon\\" string connString = "Data\\Spoon\\"; ISpoonData spoonData = SpoonWebWorker.GenerateDataWorker(SpoonDBType.LiteDB, connString); //Postgres DB connection string, for instance: "database=xxxx; host=xxx.xxx.xxx.xxx.com; username=xxx; password=xxx; SslMode=Prefer; port=1234;" //string connString = Configuration["PostGresDBSettings:ConnectionString"]; //ISpoonData spoonData = SpoonWebWorker.GenerateDataWorker(SpoonDBType.PostGres, connString); SpoonWebWorker.AdminPath = "/adminControl"; SpoonWebWorker.SpoonData = spoonData; //Will need to have some sort of user management system for this to work SpoonWebWorker.RequireAuth = false; SpoonWebWorker.AuthClaims = new List <Claim>() { new Claim(ClaimTypes.Role, "admins"), new Claim(ClaimTypes.Name, "John") }; services.AddSingleton <ISpoonData>(spoonData); services.AddMvc(); }
public IActionResult Admin() { return(Content(SpoonWebWorker.GenerateResponseString(Request.HttpContext, true), "text/html")); }