Path: redb-identity/tests/redb.Identity.Tests/Authorization/AdminEndpointAuthMatrixTests.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/AdminEndpointAuthMatrixTests.cs
----
using System.Net;
using System.Net.Http.Headers;
using AwesomeAssertions;
using redb.Identity.Tests.Infrastructure;
using Xunit;
namespace redb.Identity.Tests.Authorization;
///
/// G14 — endpoint-matrix smoke for management-API authorization.
///
/// The HTTP facade routes management endpoints through
/// ManagementBearerAuthProcessor which requires a bearer access token whose
/// scopes intersect { identity:manage, identity:account, scim } (see
/// ProductionHttpFixture.InitializeAsync wiring). This test asserts the
/// invariant per endpoint:
///
/// no token → 401 (cannot enumerate without an access token);
/// token without the required scope → 403 (e.g. scim token on
/// management routes, or identity:manage token on SCIM routes);
/// token with the right scope → 2xx.
///
///
///
/// Without this matrix, a refactor that drops ManagementBearerAuthProcessor
/// from a single endpoint would silently expose admin operations to unauthenticated
/// callers — exactly the IDOR-shaped regression that G14 / B8 aims to lock down.
///
///
[Collection("ProductionHttp")]
public sealed class AdminEndpointAuthMatrixTests
{
private readonly ProductionHttpFixture _fx;
public AdminEndpointAuthMatrixTests(ProductionHttpFixture fx) => _fx = fx;
/// Endpoints requiring identity:manage (or identity:account when self-scoped).
public static IEnumerable