Добавил настройки для аутентификации

parent 168958d0
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Store.Extensions; using Store.Extensions;
using Store.Models; using Store.Models;
...@@ -22,6 +23,19 @@ services.Configure<IdentityOptions>(options => ...@@ -22,6 +23,19 @@ services.Configure<IdentityOptions>(options =>
options.Password.RequiredUniqueChars = 1; options.Password.RequiredUniqueChars = 1;
}); });
services.ConfigureApplicationCookie(options =>
{
options.AccessDeniedPath = "/Accounts/AccessDenied";
options.Cookie.Name = "YourAppCookieName";
options.Cookie.HttpOnly = true;
options.ExpireTimeSpan = TimeSpan.FromMinutes(60);
options.LoginPath = "/Accounts/Login";
// ReturnUrlParameter requires
//using Microsoft.AspNetCore.Authentication.Cookies;
options.ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter;
options.SlidingExpiration = true;
});
var app = builder.Build(); var app = builder.Build();
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment