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
class 中,我找到了这段代码:
// 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.Authentication 的 AuthenticationManager.SignInAsync method and AuthenticationProperties.IsPersistent 属性.
它与登录页面上的 "Remember Me" 复选框配合使用。
参见:
Persistent cookies will be saved as files in the browser folders until they either expire or manually deleted. This will cause the cookie to persist even if you close the browser.
If IsPersistent is set to false, the browser will acquire session cookie which gets cleared when the browser is closed.
Now the reason session cookie wont clear after restarting the browser is because of chrome default settings. To fix it go to chrome settings -> advanced, and uncheck Continue running background apps when Google Chrome is closed under System section.
是的,这是一个拼写错误。
我正在使用 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
class 中,我找到了这段代码:
// 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.Authentication 的 AuthenticationManager.SignInAsync method and AuthenticationProperties.IsPersistent 属性.
它与登录页面上的 "Remember Me" 复选框配合使用。
参见
Persistent cookies will be saved as files in the browser folders until they either expire or manually deleted. This will cause the cookie to persist even if you close the browser.
If IsPersistent is set to false, the browser will acquire session cookie which gets cleared when the browser is closed.
Now the reason session cookie wont clear after restarting the browser is because of chrome default settings. To fix it go to chrome settings -> advanced, and uncheck Continue running background apps when Google Chrome is closed under System section.
是的,这是一个拼写错误。