Module principal
Expand description
The RFC 7141 identity contract: what an auth provider outputs
(AuthenticatedIdentity) and what the shared resolver turns it into
(the canonical Principal).
Three stages, three vocabularies (Rev 8):
- A provider verifies ONE credential and emits an
AuthenticatedIdentity— provenance, subject, actor kind, verified claims, expiry/revalidation metadata. Providers never emit grants. - The shared resolver (in
zeroclaw-runtime) maps that identity to a canonicalPrincipalIdand the currently-configured permission profiles. Claims are mapping inputs, never runtime grants. - Dispatch/gateway/storage surfaces consume the resolved
Principalplus its separately-resolvedcrate::grants::ResolvedGrants. Grants are NOT stored on thePrincipal: they are re-resolved from current policy at the authorization-generation boundary, so a profile or mapping change affects established connections without reconnect.
Structs§
- Agent
Alias - An agent alias a principal may bind at session start. Newtype so it never
gets confused with an arbitrary
Stringin grant checks. - Authenticated
Identity - What an auth provider outputs after verifying ONE credential: identity and
evidence, never grants. Handshake-scoped and server-side only — this type
is deliberately not serializable, and its
Debugnever prints claim values (claims may carry personal data). - Principal
- The canonical resolved principal: the single non-secret record every dispatch/audit/isolation surface consumes.
- Principal
Id - Canonical, globally-unambiguous principal identifier. The durable ownership key for sessions, private memory, approvals, and audit attribution.
Enums§
- Actor
Kind - What kind of actor an identity represents. Human and service identities stay distinct end-to-end: a service principal never inherits interactive browser sessions or private user memory because claims have similar names.
- Auth
Method - Auth
Outcome - The single result every credential verification returns. Misroute,
timeout, or malformed input ⇒
AuthOutcome::Denied, NEVER a silent allow. Once a provider was selected for a credential, its denial is authoritative: there is no fallback to another provider or to broader authority. - Deny
Reason - Why a credential was rejected. Fail-closed: any ambiguity ⇒ a
Deniedvariant, never a silent allow. - Identity
Subject - The verified subject of an
AuthenticatedIdentity. Each variant carries exactly the fields its canonicalPrincipalIdis composed from, so a provider cannot construct an ambiguous or cross-class identity.