Can a global authorization policy automatically protect all minimal API endpoints without per‑endpoint metadata?
0 reputation · 12 Dec 2025, 16:26 UTC
Goal
Determine whether configuring a global authorization policy in an ASP.NET Core minimal API is sufficient to enforce authentication on every mapped route, or if each endpoint still requires explicit authorization metadata.
Constraints and uncertainty
The application uses .NET 6+ minimal APIs with authentication services registered. No [Authorize] attributes or RequireAuthorization() calls are added to individual endpoints. Documentation indicates that authorization is opt‑in, but it is unclear whether a globally registered policy changes the default allow‑anonymous behavior for endpoints that lack any authorization metadata.
Specific questions:
- Does adding a global authorization policy automatically secure endpoints that have no explicit
RequireAuthorizationcall? - If not, what configuration pattern enforces a deny‑by‑default stance across all minimal API routes without decorating each one?