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.

Cookie MW null reference exception #270

@dolly22

Description

@dolly22

I'm getting null reference exception from cookie authentication middleware when protecting authentication ticket. This happens when the following conditions occur on request:

  1. Sliding expiration is enabled and enough time passed so middleware tries to refresh authentication ticket (setting _shouldRenew = true)
  2. Principal is rejected in Options.Notifications.ValidatePrincipal notification (setting Context.Principal = null)
  3. _shouldRenew path is hit inside ApplyResponseGrantAsync() and null reference is thrown from Options.TicketDataFormat.Protect(model); because Principal was set to null.

Also Security/src/Microsoft.AspNet.Authentication.Cookies/Notifications/CookieValidateIdentityContext.cs should be probably renamed to CookieValidatePrincipalContext.cs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions