Skip to content
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
@nickcam

Description

@nickcam

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions