-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add AuthorizationBuilder #42264
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
Add AuthorizationBuilder #42264
Conversation
Yeah I like this approach that enables us to return the builder from |
src/Security/Authorization/Core/src/AuthorizationServiceCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
Updated with new proposed AddAuthorizationBuilder name |
@DamianEdwards is this something you want me to get in for preview6, or can this wait for preview7? The PR Is basically ready, since I don't have to update all tests to use the new API |
It would still need an API review and we should likely do this change at the same time as introducing the new |
@captainsafia do you want to make the WAB.Authorization side of things in my branch or do you want me to do it (for preview 7)? |
Lets put this up for API review (write an API proposal based on this PR in the issue) |
@@ -29,7 +29,7 @@ public AuthorizationBuilder(IServiceCollection services) | |||
/// Defaults to true. | |||
/// </summary> | |||
/// <returns>The builder.</returns> | |||
public virtual AuthorizationBuilder SetInvokeHandlersAfterFailure(bool invoke) | |||
public virtual AuthorizationBuilder InvokeHandlersAfterFailure(bool invoke) |
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.
Set* seems better tbh
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.
Okay, going back to the original SetInvokeHandlersAfterFailure
AuthZ part of #42235
I didn't update everything, but updated enough of the tests to feel confident that this does reduce lines of code even just in our tests, and that the basics are working, will finish the rest of this assuming this is something that we want to take for real.
Before
After
Note: this does change the return value for AddAuthorization* methods to return the new AuthorizationBuilderServiceCollection that wraps the service collection
cc @DamianEdwards @davidfowl @captainsafia @adityamandaleeka