Skip to content

Endpoint routing should complain if you do not have middleware configured #9041

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

Closed
pranavkm opened this issue Apr 3, 2019 · 0 comments
Closed
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Apr 3, 2019

As part of #8387, we are going to make MVC rely on the Auth and Cors middlewares to perform work rather than rely on filters when endpoint routing is enabled. Doing this is fairly straightforward, we need to ensure that the right endpoint metadata is available, and the middleware is configured.

A fall-out of this choice is that we need to guarantee that the auth or cors middleware was configured in the request pipeline failing which the presence of these attributes would have done nothing.

One design that seems promising for this is for EndpointRoutingMiddleware to complain if the auth or cors middleware isn't configured. Psuedo-code:

if (!context.Items.ContainsKey(AuthorizationMiddlewareInvokedKey) && HasAuthAttribute(endpoint))
{
   throw;
}

Endpoint routing does not currently reference Auth or Cors and it would be preferable to leave it so.

@pranavkm pranavkm added this to the 3.0.0-preview4 milestone Apr 3, 2019
@pranavkm pranavkm added 1 - Ready area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Apr 3, 2019
@pranavkm pranavkm self-assigned this Apr 3, 2019
pranavkm added a commit that referenced this issue Apr 8, 2019
pranavkm added a commit that referenced this issue Apr 9, 2019
pranavkm added a commit that referenced this issue Apr 10, 2019
@pranavkm pranavkm added Done This issue has been fixed and removed 2 - Working labels Apr 18, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests

2 participants