diff --git a/API/Program.cs b/API/Program.cs index 46b68d9..8ab0673 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -6,6 +6,7 @@ using API.Services; using API.Services.Interfaces; using DAL.Contexts; using DAL.Models; +using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.EntityFrameworkCore; using Serilog; using System.Reflection; @@ -72,6 +73,9 @@ namespace API return new UserManager(userService, hashingFactory, logger, hashingType); }); + + builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(); + WebApplication app = builder.Build(); if (app.Environment.IsDevelopment()) @@ -85,6 +89,8 @@ namespace API MinimumSameSitePolicy = SameSiteMode.Strict }); + app.UseAuthorization(); + app.UseHttpsRedirection(); app.MapControllers(); app.Run();