Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Two factor cookie options in ASP Core 2.0

$
0
0

Hi,

I was able to configure the two factor authentication cookie name / expiry time in ASP .NET Core 1.0 using the following code.

services.AddIdentity<ApplicationUser, IdentityRole>(o =>
{
// Configure Identity Options
o.Cookies.TwoFactorUserIdCookie.CookieName = "twofactor_login";
o.Cookies.TwoFactorRememberMeCookie.CookieName = "twofactor_remember";
o.Cookies.TwoFactorRememberMeCookie.SlidingExpiration = false;
o.Cookies.TwoFactorRememberMeCookie.ExpireTimeSpan = TimeSpan.FromDays(1);
})
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders();

In ASP Core 2.0, I'm able to find the option only for configuring application cookie, not the two factor cookies. 

 services.ConfigureApplicationCookie(o =>
 {
     o.Cookie.Name = "app_user";
     o.Cookie.Expiration = TimeSpan.FromMinutes(30);
     o.ExpireTimeSpan = TimeSpan.FromMinutes(30);
     o.SlidingExpiration = true;
     o.LoginPath = new PathString("/account/login");
 });

Please provide your thoughts on this.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>