-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Cache effective policy in endpoint metadata #43124
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
Conversation
src/Security/Authorization/Core/src/AuthorizationPolicyCache.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Core/src/AuthorizationPolicyCache.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Core/src/AuthorizationPolicyCache.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationEndpointConventionBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationEndpointConventionBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
|
I'll send out an email API review for this now |
|
Thank you for your API proposal. I'm removing the |
|
Updated to WithAuthorizationPolicyCache and IVT for the metadata per #43227 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to only add AuthorizationPolicyCache if there are IAuthorizeData or AuthorizationPolicy is available in the metadata. Also the new Finally method could be used instead of Add.
…ventionBuilderExtensions.cs Co-authored-by: Kahbazi <A.Kahbazi@gmail.com>
Co-authored-by: David Fowler <davidfowl@gmail.com>
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
| // Cache the computed policy | ||
| if (policy != null && canCachePolicy) | ||
| { | ||
| _policyCache!.Value![endpoint!] = policy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the symbols here are funny 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the cache code is very excited!!!
src/Security/Authorization/Core/src/DefaultAuthorizationPolicyProvider.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: David Fowler <davidfowl@gmail.com>
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationMiddleware.cs
Outdated
Show resolved
Hide resolved
src/Security/Authorization/Policy/src/AuthorizationPolicyCache.cs
Outdated
Show resolved
Hide resolved
|
|
||
| public void Store(Endpoint endpoint, AuthorizationPolicy policy) | ||
| { | ||
| _policyCache!.Value![endpoint!] = policy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more null checks!
| _policyCache!.Value![endpoint!] = policy; | |
| _policyCache.Value[endpoint] = policy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value can still be null I think or at least vs says so
Perf followup to #39840
This adds a metadata cache so we cache the computed policies per endpoint
Fixes #43227