Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove several Lazy-related objects from every TokenValidationResult … #2193

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

brentschmaltz
Copy link
Member

This was originally committed by Stephen to dev7x in this PR: #2180

  • Remove several Lazy-related objects from every TokenValidationResult

Creating a TokenValidationResult is also creating a Lazy<>, a LazyHelper internal to the Lazy<>, and a Func<> delegate due to the lambda passed to the lazy closing over this. Offline discussion also suggested that thread-safe initialization is important, including for ClaimsIdentity which isn't currently protected. So instead, this commit changes the scheme employed to use double-checked locking directly for ClaimsIdentity and then optimistic synchronization with Interlocked for Claims, as well as for the separate property bag property that was previously always instantiated.

  • Address PR feedback

…2180)

* Remove several Lazy-related objects from every TokenValidationResult

Creating a TokenValidationResult is also creating a `Lazy<>`, a `LazyHelper` internal to the `Lazy<>`, and a `Func<>` delegate due to the lambda passed to the lazy closing over `this`. Offline discussion also suggested that thread-safe initialization is important, including for ClaimsIdentity which isn't currently protected. So instead, this commit changes the scheme employed to use double-checked locking directly for ClaimsIdentity and then optimistic synchronization with Interlocked for Claims, as well as for the separate property bag property that was previously always instantiated.

* Address PR feedback
@brentschmaltz brentschmaltz merged commit 8611b11 into dev7 Jul 28, 2023
@brentschmaltz brentschmaltz deleted the brentsch/RemoveLazyObjects branch July 28, 2023 16:07
@jennyf19 jennyf19 added this to the 7.0.0-preview2 milestone Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants