aspnet/Security — pull request #90 by HaoK (2014-11-06 00:29:47+00:00)
Title: Prototype notification unification (eventbus proof of concept for cookies + identity)

cc @loudej @Tratcher @divega

First stab at adding a common event bus thingy for identity/security to share(Seems like this should live lower than Security, no idea where though). I only updated CookieMiddleware to enable the SecurityStamp for Identity scenario as the proof of concept. One immediate takeaway also is that the eventbus would be another a new ILogger like thing which always needs to be there, or stuff be broke... Another reason to get that default/fallback service feature in I guess...

Thoughts? Hooking the events is a bit gross compared to the old notifications, but if we can add the appropriate sugar, maybe it won't be too bad. But unfortunately unlike the old Options configuration, in this prototype setting up the notifications needs to be done to DI, which means ConfigureServices :(

Identity hooks up the security stamp validator to a cookie notification for the appropriate CookieMiddleware via authentication type, this would be done inside of the services.AddIdentity method during ConfigureServices:

services.AddInstance(
new CookieEventHandler(
IdentityOptions.ApplicationCookieAuthenticationType,
context => SecurityStampValidator.ValidateIdentityAsync(context)));