pub struct ForwardDerivation {
pub keep_verified_user: bool,
pub keep_roles: bool,
pub keep_capabilities: bool,
pub keep_metadata: bool,
}Expand description
What a policy returns: a derivation request, NOT a constructed context.
The framework consumes this and mints the next sealed AuthContext for
the callee. The shape is intentionally minimal for v1 — four “keep”
flags, one per logical group of the caller’s context. Future composable
primitives (AUTHLANG v2) will replace this with a richer combinator AST
without breaking the v1 trait signature.
§Derive-only invariant
Every field is a “keep” flag: forward this field from the caller to the callee, or drop it. There is no “add this role” or “set this user_id” knob. Policies cannot escalate authority across a boundary — the most-permissive a callee context can be is exactly the caller’s context.
§Field-to-AuthContext mapping (today)
| Flag | Maps to fields on the current AuthContext |
|---|---|
keep_verified_user | user_id, session_id (identity of the originator) |
keep_roles | roles |
keep_capabilities | (no field yet; reserved for AUTHZ-DATA / AUTHZ-CRED work) |
keep_metadata | metadata |
keep_capabilities is intentionally surfaced now so the v1 shape is
forward-compatible: when the sealed-context migration adds a
capabilities field, no policy impl signature changes.
Fields§
§keep_verified_user: boolForward the IdP-verified originator’s identity (user_id, session_id).
keep_roles: boolForward the caller’s role set (roles).
keep_capabilities: boolForward the caller’s capability set. Reserved for the
AUTHZ-DATA / AUTHZ-CRED migration; today this flag is a no-op on
AuthContext because the field does not yet exist.
keep_metadata: boolForward the caller’s opaque metadata bag (metadata).
Implementations§
Source§impl ForwardDerivation
impl ForwardDerivation
Sourcepub const IDENTITY_ONLY: Self
pub const IDENTITY_ONLY: Self
Identity-only: keep verified user; drop roles, capabilities, metadata.
Sourcepub const PASS_THROUGH: Self
pub const PASS_THROUGH: Self
Pass-through: keep every flag.
Trait Implementations§
Source§impl Clone for ForwardDerivation
impl Clone for ForwardDerivation
Source§fn clone(&self) -> ForwardDerivation
fn clone(&self) -> ForwardDerivation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ForwardDerivation
impl Debug for ForwardDerivation
Source§impl<'de> Deserialize<'de> for ForwardDerivation
impl<'de> Deserialize<'de> for ForwardDerivation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ForwardDerivation
impl PartialEq for ForwardDerivation
Source§fn eq(&self, other: &ForwardDerivation) -> bool
fn eq(&self, other: &ForwardDerivation) -> bool
self and other values to be equal, and is used by ==.