food-market/src
nurdotnet 4ebc4cb0c2 fix(auth): OtherSystem admin endpoint uses policy-based auth on role claim directly
ASP.NET Core's [Authorize(Roles=...)] relies on ClaimsIdentity.RoleClaimType to
match, which may not be wired to "role" in the OpenIddict validation handler's
identity (depending on middleware order with AddIdentity). Tokens clearly carry
"role": "Admin" but IsInRole("Admin") returns false.

- Register AddAuthorization policy "AdminAccess" that checks the `role` claim
  explicitly (c.Type == Claims.Role && Value in {Admin, SuperAdmin}). Works
  regardless of how ClaimsIdentity was constructed.
- OtherSystemImportController now uses [Authorize(Policy = "AdminAccess")].
- Add /api/_debug/whoami that echoes authType, roleClaimType, claims, and
  IsInRole result — makes next auth issue trivial to diagnose.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 23:18:27 +05:00
..
food-market.api fix(auth): OtherSystem admin endpoint uses policy-based auth on role claim directly 2026-04-21 23:18:27 +05:00
food-market.application phase1b: catalog CRUD API (countries, currencies, vat, units, stores, retail points, product groups, counterparties, products) 2026-04-21 19:22:56 +05:00
food-market.domain phase1a: catalog domain (countries, currencies, vat, units, counterparties, stores, retail points, products) 2026-04-21 19:16:10 +05:00
food-market.infrastructure phase1e: OtherSystem import integration (admin-only, per-request token, no persistence) 2026-04-21 21:07:58 +05:00
food-market.pos Phase 0: project scaffolding and end-to-end auth 2026-04-21 13:59:13 +05:00
food-market.pos.core Phase 0: project scaffolding and end-to-end auth 2026-04-21 13:59:13 +05:00
food-market.shared Phase 0: project scaffolding and end-to-end auth 2026-04-21 13:59:13 +05:00
food-market.web fix(auth): return 401 instead of 302 for API challenges; persist dev signing key across restarts 2026-04-21 21:42:53 +05:00