我需要帮助记住我。我似乎找不到任何东西来帮助我寻找的东西。记住,我似乎没有做任何事情来改变我的注销时间。
在startup.auth.cs中,我有:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = MyAuthentication.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
//Provider = new CookieAuthenticationProvider(),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(0),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
},
CookieName = "MyCookieName",
CookieHttpOnly = true,
ExpireTimeSpan = TimeSpan.FromHours(1), // adjust to your needs
});
authenticationManager.SignOut(MyAuthentication.ApplicationCookie);
authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = RememberMe }, identity);
authenticationManager从传入
IAuthenticationManager authenticationManager = HttpContext.GetOwinContext().Authentication;
我要遗漏什么?无论IsPersistent是否为true,总是在一小时后注销而不处于活动状态。我不完全理解“记住我”功能应该如何工作。