Program now uses Authentication and Authorization
This commit is contained in:
parent
1dd4d3dca7
commit
18ab0b592f
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user