Add OnClaimsReceived event #13
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey @MaximRouiller!
This PR relates to #11 and provides a mechanism by which claims can be transformed. Rather than just transforming roles claims "in the box", this provides the consumer an
OnClaimsReceivedevent which allows them to transform claims prior to them being supplied to the Principal.To support the use case discussed in #11 of transforming roles claims, a user would do something like the following:
I've made the hook
asyncto align with the general pattern I see throughout the .NET codebase; see https://github.com/dotnet/aspnetcore/blob/master/src/Security/Authentication/Core/src/Events/RemoteAuthenticationEvents.cs for reference.I've also added a
EasyAuthAuthenticationDefaults.AuthenticationScheme = "EasyAuth"const which I thought was "nice to have" - completely not necessary but again aligns nicely with https://github.com/dotnet/aspnetcore/blob/master/src/Security/Authentication/Cookies/src/CookieAuthenticationDefaults.cs#L16I've tested this with a project of mine deployed to an App Service and it's worked well. What do you think?