1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Tenant primitives — AUTHZ-0 layer 4 (data isolation).
//!
//! This module hosts the sealed `Tenant` value, the `TenantError` enum,
//! and the `TenantResolver` trait + default implementations. Together they
//! are the structural foundation for tenant isolation:
//!
//! - `Tenant` is a sealed newtype over `String`. The constructor is
//! `pub(crate)` to `plexus-auth-core`. Activation code cannot fabricate a
//! `Tenant` from a string literal: the only path to a `Tenant` value is
//! through the framework's `TenantResolver`, which derives one from a
//! verified `AuthContext`.
//!
//! - `TenantResolver` is an async trait. Backends supply an impl;
//! `ClaimTenantResolver` covers the 80% case (pull tenant from a JWT
//! claim) and `SingleTenantResolver` is the explicit opt-out for
//! single-user dev installs.
//!
//! - The seal escalates from procedural (visibility within one crate) to
//! structural (crate-private constructor that no other crate can reach),
//! per AUTHZ-0 §"Crate-level isolation amplifies the seal".
//!
//! UT-1 adds two pieces on top:
//!
//! - `TenantId` (in [`types`]) — the public, validated identifier newtype
//! for tenant identity (claim values, stored tags). Data, not proof —
//! see its docs for the `TenantId` vs `Tenant` distinction.
//!
//! PLX-126 (M4·B) adds one more:
//!
//! - `TenantRole` (in [`role`]) — the enumerated vocabulary of what a
//! principal may be *within* a tenant. The membership records
//! themselves live in plexus-idp (which owns the identity database);
//! the vocabulary lives here because the crates that make decisions
//! about members — plexus-core, plexus-substrate, the M4·C mount gate —
//! depend on plexus-auth-core and can never depend on plexus-idp. See
//! that module's docs.
//!
//! - `TenantGate` (in [`gate`]) — the generalized tenant-isolation
//! predicate layer extracted from plexus-trak's reference gate: reads
//! scoped not-found, writes forbidden, anonymous writes
//! unauthenticated. Any backend registers it per request.
//!
//! See `plans/AUTHZ/AUTHZ-DATA-1-TYPES.md` for the ticket contract,
//! `plans/AUTHZ/AUTHZ-DATA-S01-output.md` §§1-2 for the design, and the
//! UT-S01 decision doc (trak facet `884cd6ad`) for the UT-1 scope.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;