This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
CookieAuthenticationHandler IsPersistent with UTC dates #780
Closed
Description
Hi Guys,
Just stumbled across a small bug I think.
Line 243 in CookieAuthenticationHandler.
if (signInContext.Properties.IsPersistent)
{
var expiresUtc = signInContext.Properties.ExpiresUtc ?? issuedUtc.Add(Options.ExpireTimeSpan);
signInContext.CookieOptions.Expires = expiresUtc.ToUniversalTime().DateTime;
}
The date signInContext.CookieOptions.Expires has the correct value, but it's kind is Unspecified, so when added to the cookie it gets converted to UTC again.
I've got a local copy of this class and just changed that line to
signInContext.CookieOptions.Expires = DateTime.SpecifyKind(expiresUtc.ToUniversalTime().DateTime, DateTimeKind.Utc);
and it's all good.
Thanks.