it ipimiutduioi
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
using GrossesMitainesAPI.Data;
|
||||
using GrossesMitainesAPI.Services;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Net;
|
||||
|
||||
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -17,6 +23,13 @@ builder.Services.AddCors(options => {
|
||||
});
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
builder.Services.AddAuthentication("Cookies").AddIdentityCookies();
|
||||
builder.Services.AddIdentityCore<InventoryUser>()
|
||||
.AddRoles<IdentityRole>()
|
||||
.AddEntityFrameworkStores<InventoryContext>()
|
||||
.AddSignInManager();
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
@@ -25,6 +38,9 @@ builder.Services.AddDbContextFactory<InventoryContext>(options => { options.UseS
|
||||
builder.Services.AddSingleton<DatabaseCacheService>();
|
||||
builder.Services.BuildServiceProvider().GetRequiredService<DatabaseCacheService>();
|
||||
|
||||
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -38,6 +54,7 @@ app.UseHttpsRedirection();
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
|
||||
app.UseAuthorization();
|
||||
app.UseAuthentication();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
|
Reference in New Issue
Block a user