我尝试将2FA令牌的有效期延长至4小时,而不是默认的15分钟。
我试过这个:
public void ConfigureServices(IServiceCollection services) {
services.Configure<DataProtectionTokenProviderOptions>(options => options.TokenLifespan = TimeSpan.FromHours(4));
}
但是它不起作用,它仍然默认为15分钟。
身份设置:
services.AddIdentity<ApplicationUser, ApplicationRole>(config => {
config.User.RequireUniqueEmail = true;
config.SignIn.RequireConfirmedEmail = true;
})
.AddEntityFrameworkStores<AuthDbContext>()
.AddUserManager<ApplicationUserManager>()
.AddSignInManager<ApplicationSignInManager>()
.AddRoleManager<ApplicationRoleManager>()
.AddDefaultTokenProviders();