Skip to content

Authorization resource in endpoint routing will now be HttpContext #18944

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
HaoK opened this issue Jun 24, 2020 · 1 comment
Closed

Authorization resource in endpoint routing will now be HttpContext #18944

HaoK opened this issue Jun 24, 2020 · 1 comment

Comments

@HaoK
Copy link
Member

HaoK commented Jun 24, 2020

Copied from dotnet/docs#19034

[AspNetCore] Authorization resource in endpoint routing will now be HttpContext

Prior to this change, when using endpoint routing, the resource used for authorization would be the endpoint. This was insufficient to get access to the route data. Previously in MVC, the resource that was passed in was HttpContext which allows access to both the Endpoint and RouteData. This change just makes it so the resource passed into Authorization is always the HttpContext.

Version introduced

5.0-preview7

Old behavior

When using Endpoint routing and the AuthorizationMiddleware/AuthorizeAttributes, the resource passed into Authorization would be the matching Endpoint.

New behavior

Endpoint routing will now pass in the HttpContext into Authorization.

Reason for change

You can get to the Endpoint from the HttpContext, but there was no way to get from the Endpoint to things like the RouteData, so this was a loss in functionality from non endpoint routing.

Recommended action

If your app was using the Endpoint resource before, you will simply need to call GetEndpoint() on the HttpContext to continue to access the endpoint.

Category

  • ASP.NET Core

Affected APIs

 "Not detectable via API analysis"

Issue metadata

  • Issue type: breaking-change
@scottaddie
Copy link
Member

Moved to the aspnet/Announcements repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants