Skip to content

[Blazor] Support AllowAnonymous on Blazor #23157

@javiercn

Description

@javiercn

This prevents people from enabling authorization globally in a meaningful way for Blazor applications, since while you can apply [Authorize] globally through _Imports.Razor, that prevents you poking holes to allow individual access to unauthenticated pages.

The fixes can be:

  • Check for [AllowAnonymous] attribute here to bypass checking the auth policy.
  • Update the authorization package to handle AllowAnonymous within the authorization framework by making the policy succeed.
    • This second option is more involved but better in the end, since currently each individual framework (MVC, the authorization middleware and Blazor) all need to have code to handle this scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!area-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onegood first issueGood for newcomers.help wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions