Skip to content

Authorization broken in Razor Pages #7011

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
davidfowl opened this issue Jan 25, 2019 · 8 comments
Closed

Authorization broken in Razor Pages #7011

davidfowl opened this issue Jan 25, 2019 · 8 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@davidfowl
Copy link
Member

Describe the bug

The Authorize attribute no longer works in Razor Pages applications.

To Reproduce

  1. Make a new Razor Pages project with individual auth
  2. Add an [Authorize] attribute on the Index page
  3. Running the application doesn't redirect to the login page.

Expected behavior

The page should redirect to the Login page.

Additional context

This is using build 3.0.0-preview-19073-0424

Seems like the authorize attribute isn't being exposed as authorize metadata.

cc @rynowak @pranavkm @JamesNK

@davidfowl davidfowl added bug This issue describes a behavior which is not expected - a bug. area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Jan 25, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview2 milestone Jan 25, 2019
pranavkm added a commit that referenced this issue Jan 25, 2019
@rynowak
Copy link
Member

rynowak commented Jan 25, 2019

I think the right fix for this is that we need to introduce the concept of a dynamic endpoint. This would allow you to run code to replace the Endpoint in between the DFA phase and the EndpointSelectorPolicy phase.

This is also really useful for some of the other scenarios that have blocked users from using endpoint routing when they had a custom IRouter.

The Razor pages infrastructure would plug into this feature and use it to compile the page asynchronously, which would return the rich endpoint.

@rynowak
Copy link
Member

rynowak commented Jan 25, 2019

I've written about this idea before here: #4221 and I think it would solve many of this class of problems.

@mkArtakMSFT
Copy link
Contributor

@rynowak, do you think your suggested solution is something which can fit in preview3 timeframe?

@mkArtakMSFT
Copy link
Contributor

Looking at the thread it seems that there's a lot of discussion there and things aren't completely clear yet

@rynowak
Copy link
Member

rynowak commented Jan 25, 2019

do you think your suggested solution is something which can fit in preview3 timeframe

Yes absolutely.

pranavkm added a commit that referenced this issue Jan 25, 2019
@davidfowl
Copy link
Member Author

I’m unclear on why a new feature is required but I’ll talk to @rynowak about it later

@rynowak
Copy link
Member

rynowak commented Jan 25, 2019

Because we do routing without having compiled the pages. MVC later swaps in the compiled AD for the routable one.

mkArtakMSFT pushed a commit that referenced this issue Jan 25, 2019
@pranavkm pranavkm assigned JamesNK and unassigned pranavkm Jan 26, 2019
@pranavkm
Copy link
Contributor

@JamesNK assigning to you to fix the issue for preview3.

@JamesNK JamesNK assigned rynowak and unassigned JamesNK Feb 7, 2019
@rynowak rynowak added Done This issue has been fixed and removed 1 - Ready labels Feb 14, 2019
@rynowak rynowak reopened this Mar 12, 2019
@rynowak rynowak closed this as completed Mar 12, 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 bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests

5 participants