postIt #2
1 changed files with 1 additions and 0 deletions
fix(blogs): register controller endpoints via MapControllers
All [ApiController] classes (BlogApi, BlogTags, PostTags, FileSystem,
FileSystemStream, Comments, TagsApi) returned 404 on every route,
even though Kestrel was up. The pipeline in Program.cs was missing
MapControllers(), so the controllers were never attached to the
endpoint data source. MapIdentityApi and MapGet("/identity")
worked because they're explicit minimal-API routes; the attribute-
routed controllers didn't.
Confirmed end-to-end: GET /api/v1/blog now returns 401 (auth
required by [Authorize("BlogScope")]) instead of 404.
commit
006e05a375
|
|
@ -88,6 +88,7 @@ internal class Program
|
||||||
.UseAuthorization()
|
.UseAuthorization()
|
||||||
.UseCors("default")
|
.UseCors("default")
|
||||||
;
|
;
|
||||||
|
app.MapControllers();
|
||||||
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("BlogScope");
|
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("BlogScope");
|
||||||
|
|
||||||
app.MapGet("/identity", (HttpContext context) =>
|
app.MapGet("/identity", (HttpContext context) =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue