Path: redb-identity/tests/redb.Identity.Tests/Authorization/PerUserEndpointAuthMatrixTests.cs
Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity
Page: https://redbase.app/src/dev-2026-12-06/redb-identity/tests/redb.Identity.Tests/Authorization/PerUserEndpointAuthMatrixTests.cs
----
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using AwesomeAssertions;
using redb.Identity.Tests.Infrastructure;
using Xunit;
using redb.Identity.Core.Routes;
namespace redb.Identity.Tests.Authorization;
///
/// G14 — endpoint authorization matrix on per-user management endpoints.
///
/// Extends with the three additional
/// surface areas called out in the STATUS gap: MFA per-user endpoints, consents,
/// and applications. For each, asserts the three-token matrix:
///
/// no token → 401 (anonymous rejected);
/// wrong-scope token (SCIM-only) → 401/403;
/// management-scope token → 2xx.
///
/// This is the HTTP-surface bookend of the unit-level
/// — a regression that drops
/// ManagementBearerAuthProcessor from one of these controllers would let
/// anonymous callers mutate MFA / consents / applications.
///
///
[Collection("ProductionHttp")]
public sealed class PerUserEndpointAuthMatrixTests
{
private readonly ProductionHttpFixture _fx;
public PerUserEndpointAuthMatrixTests(ProductionHttpFixture fx) => _fx = fx;
// Endpoints that read/mutate per-user state and MUST be behind
// ManagementBearerAuthProcessor (admin or account scope).
public static IEnumerable