Skip to content
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 Account/AccessDenied endpoint to blazor web template #52167

Closed
halter73 opened this issue Nov 17, 2023 · 0 comments
Closed

Add Account/AccessDenied endpoint to blazor web template #52167

halter73 opened this issue Nov 17, 2023 · 0 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-templates
Milestone

Comments

@halter73
Copy link
Member

This was reported by a customer at https://devblogs.microsoft.com/dotnet/announcing-asp-net-core-in-dotnet-8/comment-page-2/#comment-20005

Thank you for your amazing work with the new framework, and especially Blazor!
I’m setting up authorization in my BlazorApp. When I required a specific policy for a page, and the logged in user isn’t in a role in that policy, I’m redirected to Account/AccessDenied, as expected. But this page is missing in the template. I created it manually, but I guess you would want to add it to the template in the future.

This is an oversight. "/Account/AccessDenied" is the default CookieAuthenticationOptions.AccessDeniedPath which is is used by our template, and is part of the Identity UI razor pages.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-identity Includes: Identity and providers label Nov 17, 2023
@halter73 halter73 added area-blazor Includes: Blazor, Razor Components feature-templates and removed area-identity Includes: Identity and providers labels Nov 17, 2023
@mkArtakMSFT mkArtakMSFT added this to the 8.0.x milestone Nov 22, 2023
@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label Nov 22, 2023
mkArtakMSFT pushed a commit that referenced this issue Nov 28, 2023
# Use consistent code style in Blazor project templates

- Removed usage of top-level statements in client project if "Do not use top-level statements" is selected
- Removed extra "@" in `@render-mode` values
- Always use `typeof(Namespace._Imports).Assembly` instead of `typeof(Counter).Assembly` so the compilation does not break when the sample Counter component is removed, and so the code is more consistent with how it is when no sample content is generated
- Added Account/AccessDenied endpoint to individual auth option to match Identity UI razor pages. This is shown when the user is authenticated but unauthorized by default.

Fixes #52079
Fixes #52084
Fixes #52167

## Customer Impact

In addition to not using top-level statements when the customer requests that we don't, this improves code style consistency within the Blazor project template and with the Blazor docs.

## Regression?

- [ ] Yes
- [x] No

## Risk

- [ ] High
- [ ] Medium
- [x] Low

These are small stylistic changes to the Blazor project templates.

## Verification

- [x] Manual (required)
- [ ] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A
@mkArtakMSFT mkArtakMSFT modified the milestones: 8.0.x, 8.0.1 Nov 28, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
halter73 added a commit that referenced this issue Feb 14, 2024
# Use consistent code style in Blazor project templates

- Removed usage of top-level statements in client project if "Do not use top-level statements" is selected
- Removed extra "@" in `@render-mode` values
- Always use `typeof(Namespace._Imports).Assembly` instead of `typeof(Counter).Assembly` so the compilation does not break when the sample Counter component is removed, and so the code is more consistent with how it is when no sample content is generated
- Added Account/AccessDenied endpoint to individual auth option to match Identity UI razor pages. This is shown when the user is authenticated but unauthorized by default.

Fixes #52079
Fixes #52084
Fixes #52167

## Customer Impact

In addition to not using top-level statements when the customer requests that we don't, this improves code style consistency within the Blazor project template and with the Blazor docs.

## Regression?

- [ ] Yes
- [x] No

## Risk

- [ ] High
- [ ] Medium
- [x] Low

These are small stylistic changes to the Blazor project templates.

## Verification

- [x] Manual (required)
- [ ] Automated

## Packaging changes reviewed?

- [ ] Yes
- [ ] No
- [x] N/A
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-templates
Projects
Status: Done
Development

No branches or pull requests

2 participants