-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Milestone
Description
Following discussions, we want to change the default code in Azure AD/B2C-using project templates from this:
services.AddControllersWithViews(options =>
{
var policy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.Filters.Add(new AuthorizeFilter(policy));
});
to this:
services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy
options.FallbackPolicy = options.DefaultPolicy;
});
The intention is:
- To avoid the current weirdness in the Blazor Server templates whereby default policy isn't applied to the
_Host
page or/_blazor
SignalR endpoint - Make it more obvious where you'd put custom policies. In the existing templates, people probably think they should put them in the
AddControllersWithViews
lambda but that wouldn't apply to Blazor.
Even though we first thought of this in the context of Blazor Server, the discussed plan is to change this in the other ASP.NET Core server-side templates too (for simplicitly and consistency).
Docs
Secondly, we want to clarify in docs how policies get applied in Blazor Server, and how Blazor Server endpoints are not the same as MVC or Razor Pages endpoints in terms of what gets enforced.
DamianEdwards
Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.