P
P
password222021-12-06 00:57:59
ASP.NET
password22, 2021-12-06 00:57:59

Timeout of "session" after authorization in asp.net core (.NET 5) identity, how to make not 20 minutes?

Good evening. It’s like I’m still studying asp net core, I don’t understand how to regulate the time of the "identity authorization session", that is, not just a session, but user authorization
Everything works and so on, but here's a crash 20 minutes after

Startup.cs authorization

services.AddDbContext<ApplicationDbContext>(options =>
               options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity<IdentityUser, IdentityRole>(config =>
            {
                config.Password.RequiredLength = 6;
                config.Password.RequireDigit = false;
                config.Password.RequireNonAlphanumeric = false;
                config.Password.RequireUppercase = false;
                config.Lockout.AllowedForNewUsers = true;
                config.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(2);
                config.Lockout.MaxFailedAccessAttempts = 5;
            })
                .AddEntityFrameworkStores<ApplicationDbContext>()
                .AddDefaultTokenProviders();

            services.ConfigureApplicationCookie(config =>
            {
                config.Cookie.Name = "My.Cookie";
                config.LoginPath = "/Account/Login";
                config.Cookie.HttpOnly = true;
                config.SlidingExpiration = true;
                config.ExpireTimeSpan = TimeSpan.FromHours(18);
            });

            services.AddControllersWithViews();


Well, below of course there is
app.UseAuthentication();

app.UseAuthorization();


Through the web config settings it will not help much, since the site will be on nginx, but as I understand it, web config is only for iis, like

Thanks for any help and hint

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question