[英]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.Authentication的AuthenticationManager.SignInAsync方法和AuthenticationProperties.IsPersistent屬性。
它與登錄頁面上的“記住我”復選框一起使用。
請參閱以下說明 :
永久性cookie將被保存為瀏覽器文件夾中的文件,直到它們過期或被手動刪除。 即使關閉瀏覽器,這也將導致cookie保留。
如果IsPersistent設置為false,則瀏覽器將獲取會話cookie,該會話cookie將在關閉瀏覽器時清除。
現在,重新啟動瀏覽器后無法清除會話Cookie的原因是Chrome默認設置。 要解決此問題,請轉到Chrome設置->高級,然后取消選中“系統”部分下的“關閉Google Chrome瀏覽器后繼續運行后台應用程序”。
是的,這是拼寫錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.