繁体   English   中英

ABP Cookie过期时间问题

[英]ABP cookie expiration time issue

我正在使用ABP v3.3.0。 在这个版本中,我有一些新的经验。 我的应用程序每30分钟要求登录一次,因为我的SignIn方法需要30分钟的到期时间:

_authenticationManager.SignIn(
    new AuthenticationProperties
    {
        IsPersistent = true,
        ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(int.Parse(System.Configuration.ConfigurationManager.AppSettings["AuthSession.ExpireTimeInMinutes.WhenNotPersistent"] ?? "30"))
    },
    identity);

Startup类中,我找到了以下代码:

// by setting following values, the auth cookie will expire after the
//  configured amount of time (default 14 days) when user set the
//  (IsPermanent == true) on the login
ExpireTimeSpan = new TimeSpan(int.Parse(ConfigurationManager.AppSettings["AuthSession.ExpireTimeInDays.WhenPersistent"] ?? "14"), 0, 0, 0),

但是在AccountController ,没有名为IsPermanent属性。 AuthenticationProperties是具有名为IsPersistent的属性的对象。

我猜这是一个拼写错误。 如果没有,请帮助我在登录时查找IsPermanent属性。

ABP使用Microsoft.AspNetCore.Http.AuthenticationAuthenticationManager.SignInAsync方法和AuthenticationProperties.IsPersistent属性。

它与登录页面上的“记住我”复选框一起使用。

请参阅以下说明

永久性cookie将被保存为浏览器文件夹中的文件,直到它们过期或被手动删除。 即使关闭浏览器,这也将导致cookie保留。

如果IsPersistent设置为false,则浏览器将获取会话cookie,该会话cookie将在关闭浏览器时清除。

现在,重新启动浏览器后无法清除会话Cookie的原因是Chrome默认设置。 要解决此问题,请转到Chrome设置->高级,然后取消选中“系统”部分下的“关闭Google Chrome浏览器后继续运行后台应用程序”。

是的,这是拼写错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM