Scaffolded auth

This commit is contained in:
Fergal Moran
2023-01-23 19:40:16 +00:00
parent f7aa83a18d
commit 20383b11a0
16 changed files with 1152 additions and 17 deletions

View File

@@ -1,8 +1,18 @@
using System.Net;
using System.Security.Cryptography.X509Certificates;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.EntityFrameworkCore;
using Nukitter.Web.Areas.Identity.Data;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ??
throw new InvalidOperationException("Connection string 'NukeItterContextConnection' not found.");
builder.Services.AddDbContext<NukeItterContext>(options => options.UseNpgsql(connectionString));
builder.Services.AddDefaultIdentity<NukeItterUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<NukeItterContext>();
builder.WebHost.ConfigureKestrel(options => {
options.Listen(IPAddress.Any, 5001, listenOptions => {
var certPem = File.ReadAllText("/etc/letsencrypt/live/dev.fergl.ie/fullchain.pem");
@@ -44,4 +54,4 @@ app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
app.Run();