Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Add OnSecurityStampReplacePrincipal event #977

Closed
wants to merge 3 commits into from
Closed

Add OnSecurityStampReplacePrincipal event #977

wants to merge 3 commits into from

Conversation

HaoK
Copy link
Member

@HaoK HaoK commented Sep 26, 2016

Fixes #958

Adds a new event called from the default security stamp validator which allows tweaking the user principal regeneration using the old principal.

Not super happy with the name (or the fact that the event lives at the top level of IdentityOptions)

cc @divega @blowdart

@brockallen
Copy link

or the fact that the event lives at the top level of IdentityOptions

This is why there should be a security stamp options (maybe in 2.0.0 when you can add a breaking change).

@HaoK
Copy link
Member Author

HaoK commented Oct 3, 2016

@Tratcher mind reviewing as well since you are the only other one with some context :)

@brockallen
Copy link

After a quick glance, it looks ok to me (FWIW)

@Tratcher
Copy link
Member

Tratcher commented Oct 3, 2016

What's the other event where the user can copy claims from the external cookie to the identity cookie?

@HaoK
Copy link
Member Author

HaoK commented Oct 3, 2016

CreatingTicket I believe is the other OAuth event that can be hooked

@Tratcher
Copy link
Member

Tratcher commented Oct 3, 2016

? Wasn't there an event at the identity layer?

@HaoK
Copy link
Member Author

HaoK commented Oct 3, 2016

Nope, shuttling claims around was always done directly via cookie events. We added a method which took care of some of the token refreshing, but identity doesn't expose any cookie related events, it just exposes the cookie options directly (until this PR anyways...)

/// <summary>
/// The principal contained in the current cookie.
/// </summary>
public ClaimsPrincipal Current { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CurrentPrincipal and NewPrincipal?

/// <summary>
/// Invoked when the default security stamp validator replaces the user's ClaimsPrincipal in the cookie.
/// </summary>
public Func<SecurityStampReplacingPrincipalContext, Task> OnSecurityStampReplacingPrincipal { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshing?

@HaoK
Copy link
Member Author

HaoK commented Oct 4, 2016

Sure, updated to suggested names, New/Current Principal + Replacing => Refreshing

@HaoK
Copy link
Member Author

HaoK commented Oct 13, 2016

aba7cf9

@HaoK HaoK closed this Oct 13, 2016
@HaoK HaoK deleted the haok/9-26stamp branch August 7, 2017 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants