-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Make AuthorizeFilter work in endpoint routing #9099
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
I'll work on adding more tests \ but this would be a start |
e0b7a3c
to
49eeaba
Compare
...ty.FunctionalTests/IdentityUserTests/IdentityUserAuthorizationWithoutEndpointRoutingTests.cs
Show resolved
Hide resolved
src/Mvc/Mvc.Core/src/ApplicationModels/ActionAttributeRouteModel.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.Core/test/ApplicationModels/ControllerActionDescriptorProviderTests.cs
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/ApplicationModels/CompiledPageActionDescriptorBuilder.cs
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/ApplicationModels/PageConventionCollection.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs
Show resolved
Hide resolved
src/Mvc/Mvc.Core/src/ApplicationModels/AuthorizationApplicationModelProvider.cs
Show resolved
Hide resolved
src/Mvc/Mvc.Core/src/Infrastructure/ControllerActionInvokerProvider.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/ApplicationModels/PageApplicationModel.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/ApplicationModels/PageConventionCollection.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/Infrastructure/PageActionInvokerProvider.cs
Outdated
Show resolved
Hide resolved
src/Mvc/test/Mvc.FunctionalTests/GlobalAuthorizationFilterEndpointRoutingTest.cs
Show resolved
Hide resolved
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.
This looks a lot like what I expected!
There are a few really ugly things here, but that's not really something we can avoid.
src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
src/Mvc/Mvc.RazorPages/src/DependencyInjection/PageConventionCollectionExtensions.cs
Outdated
Show resolved
Hide resolved
|
||
return LoginAB(page); | ||
} | ||
|
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.
Historically the place we see the most bugs is when there's a action that is trying to mix cookies and bearer, if its not too hard, do you think you can add one or two tests for that scenario here?
Basically something like:
[Authorize] // requires any authenticated user (aka the application cookie typically)
public class Controller {
[Authorize(AuthenticationScheme = "Bearer")]
public void Api();
public void Cookie();
[AllowAnonymous]
public void PartyOn();
And ideally there would be a few tests that calls these actions at least twice in a few different orders (i.e. anon, bearer, cookie vs cookie, anon, bearer, etc) to make sure that we catch something like #7687
07ded1c
to
9c99a93
Compare
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.
19340a9
to
64e99f9
Compare
64e99f9
to
a3a7f92
Compare
(cherry picked from commit 9d32070)
Fixes #8387