GeneratePasswordResetTokenAsync 和 GenerateUserTokenAsync 的默认 TokenLifespan 是多少

What is the default TokenLifespan of GeneratePasswordResetTokenAsync and GenerateUserTokenAsync

我到处都看了,似乎无法确定其中每一个的默认值是什么。

我还需要知道是否有办法为每个设置不同的寿命。 谢谢,

任何令牌的默认值显然都是 24 小时。您可以将其设置为不同的值,但相同的值将同样适用于所有标记(GenerateEmailConfirmationTokenAsyncGeneratePasswordResetTokenAsyncGenerateUserTokenAsync)。

通过在 App_Start\IdentityConfig.cs 文件的 ApplicationUserManager.Create 方法中指定 TokenLifespan = TimeSpan.FromHours(3) 来设置新值:

        if (dataProtectionProvider != null)
        {
            manager.UserTokenProvider =
                new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"))
                {
                    // Added custom code to set a different lifespan
                    TokenLifespan = TimeSpan.FromHours(3)
                };
            ;
        }
        return manager;

来源:http://www.asp.net/identity/overview/features-api/account-confirmation-and-password-recovery-with-aspnet-identity

不同类型代币的不同生命周期:看起来像是推迟到下一个 "major update",据此:https://aspnetidentity.codeplex.com/workitem/2228.