|
|
|
@ -1,12 +1,10 @@ |
|
|
|
using EVABackend.Areas.Identity.Data; |
|
|
|
using EVABackend.Areas.Identity.Data; |
|
|
|
using EVABackend.Models; |
|
|
|
using EVABackend.Models; |
|
|
|
using Microsoft.AspNetCore.Authentication.Cookies; |
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
using Microsoft.AspNetCore.Identity; |
|
|
|
using Microsoft.AspNetCore.Identity; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using System; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[assembly: HostingStartup(typeof(EVABackend.Areas.Identity.IdentityHostingStartup))] |
|
|
|
[assembly: HostingStartup(typeof(EVABackend.Areas.Identity.IdentityHostingStartup))] |
|
|
|
namespace EVABackend.Areas.Identity |
|
|
|
namespace EVABackend.Areas.Identity |
|
|
|
@ -18,10 +16,9 @@ namespace EVABackend.Areas.Identity |
|
|
|
builder.ConfigureServices((context, services) => |
|
|
|
builder.ConfigureServices((context, services) => |
|
|
|
{ |
|
|
|
{ |
|
|
|
services.AddDbContext<EVABackendIdentityContext>(options => |
|
|
|
services.AddDbContext<EVABackendIdentityContext>(options => |
|
|
|
options.UseSqlite( |
|
|
|
options.UseSqlite(context.Configuration.GetConnectionString("EVABackendIdentityContextConnection"))); |
|
|
|
context.Configuration.GetConnectionString("EVABackendIdentityContextConnection"))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services.AddDefaultIdentity<EVABackendUser>() |
|
|
|
services.AddIdentity<EVABackendUser, IdentityRole>() |
|
|
|
.AddRoles<IdentityRole>() |
|
|
|
.AddRoles<IdentityRole>() |
|
|
|
.AddEntityFrameworkStores<EVABackendIdentityContext>() |
|
|
|
.AddEntityFrameworkStores<EVABackendIdentityContext>() |
|
|
|
.AddDefaultTokenProviders(); |
|
|
|
.AddDefaultTokenProviders(); |
|
|
|
@ -29,6 +26,9 @@ namespace EVABackend.Areas.Identity |
|
|
|
services.ConfigureApplicationCookie(options => |
|
|
|
services.ConfigureApplicationCookie(options => |
|
|
|
{ |
|
|
|
{ |
|
|
|
options.Cookie.Name = "EVABackend_Token"; |
|
|
|
options.Cookie.Name = "EVABackend_Token"; |
|
|
|
|
|
|
|
options.LoginPath = $"/unauthorized"; |
|
|
|
|
|
|
|
options.LogoutPath = $"/unauthorized"; |
|
|
|
|
|
|
|
options.AccessDeniedPath = $"/unauthorized"; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|