Expand description
Forwarding-policy primitives — CallSite, ForwardDerivation,
ForwardPolicyName, the ForwardPolicy trait, and the v1 named impls
(IdentityOnly, PassThrough, Anonymous).
Per AUTHLANG-S01-output §1 (pinned design) and AUTHLANG-2.
§Sealed-type invariant (load-bearing)
A ForwardPolicy impl receives a sealed &AuthContext and a
&CallSite and returns a ForwardDerivation — parameters for
how to derive the callee’s auth context, NOT a constructed
AuthContext. The framework consumes the derivation and mints the
next sealed context via crate::auth::AuthContext::derive_callee_context,
which is pub(crate) to plexus-auth-core. Activations and other
downstream crates cannot reach that constructor.
Per AUTHZ-0 §“The sealed-type pattern”: the policy proposes; the
framework disposes. Policies can shrink a context (drop fields)
but never grow it (add or set fields). ForwardDerivation’s shape
enforces this structurally — every field is a “keep” flag; there is no
“add” or “set” knob.
§Module surface
CallSite— one edge in the call graph at policy-run time.ForwardDerivation— a flag set returned by the policy.ForwardPolicyName— newtype identifying which policy ran (audit).ForwardPolicytrait — what custom impls implement.IdentityOnly,PassThrough,Anonymous— v1 built-ins.
Structs§
- Anonymous
- Anonymous: drop the entire
AuthContext. - Call
Site - Identifies a single edge in the call graph at the moment a policy runs.
- Forward
Derivation - What a policy returns: a derivation request, NOT a constructed context.
- Forward
Policy Name - Stable identifier for a forwarding policy, surfaced into audit records and diagnostics.
- Identity
Only - Identity-only: forwards the caller’s IdP-verified user identity and drops roles, capabilities, and metadata.
- Pass
Through - Pass-through: forward every field of the caller’s context.
Constants§
- ANONYMOUS_
NAME - The
anonymouspolicy name (stable string surfaced in audit). - IDENTITY_
ONLY_ NAME - The
identity_onlypolicy name (stable string surfaced in audit). - PASS_
THROUGH_ NAME - The
pass_throughpolicy name (stable string surfaced in audit).
Traits§
- Forward
Policy - The forwarding-policy trait.