diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-09-15 10:31:20 +1000 |
|---|---|---|
| committer | Jake Mannens <jakem_5@hotmail.com> | 2026-01-14 20:28:34 +1100 |
| commit | 5565be07f8d8d473759315fd99747c64e2ce3450 (patch) | |
| tree | fe0323eebd9981d1f2bad219bff5ac9cd4b674aa /Program.cs | |
| parent | 6255f7c74687934e6701ddd98f5e3a84de78c451 (diff) | |
Completed initial login functionality
Diffstat (limited to 'Program.cs')
| -rw-r--r-- | Program.cs | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1,12 +1,16 @@ using Microsoft.EntityFrameworkCore; using System.Text.Json.Serialization; using HyperBooru.Services; +using Microsoft.AspNetCore.Authentication.Cookies; namespace HyperBooru; public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); + builder.Services.AddHttpContextAccessor(); + builder.Services.AddAuthentication( + CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(); builder.Services.AddControllers().AddJsonOptions(o => { var converter = new JsonStringEnumConverter(); o.JsonSerializerOptions.Converters.Add(converter); @@ -20,7 +24,7 @@ public class Program { builder.Services.AddScoped<ISearchService, SearchService>(); builder.Services.AddScoped<ITagService, TagService>(); builder.Services.AddScoped<IMediaService, MediaService>(); - builder.Services.AddSingleton<IUserService, UserService>(); + builder.Services.AddScoped<IUserService, UserService>(); builder.Services.AddHostedService<OcrService>(); var app = builder.Build(); |
