Replies: 1 comment 1 reply
-
CookieAuthenticationHandler should be re-created per request so that should be resetting the _shouldRefresh field. If you're somehow re-using the CookieAuthenticationHandler across requests that would be bad. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. I'm not raising this as an issue incase I've misunderstood, but I wonder if current expiration logic is as expected.
This article states that the cookie is re-issued:
It looks like this is achieved through setting
_shouldRenew
totrue
:aspnetcore/src/Security/Authentication/Cookies/src/CookieAuthenticationHandler.cs
Line 108 in 4fdc35d
However, I can't see that this value ever goes
false
again, so every subsequent request causes a call toRenewAsync
.In my tests, setting the
ExpireTimeSpan
of theCookieAuthenticationOptions
instance to (e.g.) 10 minutes correctly exposes the cookie on the creation response, and then not again until 5 minutes later. However, every response after that first 5 minutes includes the cookie with an updated expiry time.It's not causing us any issues, but it seemed odd so thought I'd reach out.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions