Consider adding an IEndpointConventionBuilder.RequireAuthorization overload that accepts an AuthorizationPolicy #18497
Labels
area-auth
Includes: Authn, Authz, OAuth, OIDC, Bearer
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Milestone
Endpoint routing has a way to configure auth using
RequireAuthorization
: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.authorizationendpointconventionbuilderextensions?view=aspnetcore-3.1. The overloads allow specifying names of policies, but no way of specifying a policy itself.Compare this to
AuthorizeFilter
which has an overload that allows specifying a policy: https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.authorization.authorizefilter.-ctor?view=aspnetcore-3.1#Microsoft_AspNetCore_Mvc_Authorization_AuthorizeFilter__ctor_Microsoft_AspNetCore_Authorization_AuthorizationPolicy_This overload allows for fairly easy to follow auth setup:
aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs
Lines 112 to 118 in bc60e95
The text was updated successfully, but these errors were encountered: