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 API.Services.Interfaces;
|
||||||
using DAL.Contexts;
|
using DAL.Contexts;
|
||||||
using DAL.Models;
|
using DAL.Models;
|
||||||
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -72,6 +73,9 @@ namespace API
|
|||||||
return new UserManager(userService, hashingFactory, logger, hashingType);
|
return new UserManager(userService, hashingFactory, logger, hashingType);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
|
||||||
|
|
||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
@ -85,6 +89,8 @@ namespace API
|
|||||||
MinimumSameSitePolicy = SameSiteMode.Strict
|
MinimumSameSitePolicy = SameSiteMode.Strict
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
app.Run();
|
app.Run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user