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: ForwardDerivation
pub const IDENTITY_ONLY: ForwardDerivation
Identity-only: keep verified user; drop roles, capabilities, metadata.
Sourcepub const PASS_THROUGH: ForwardDerivation
pub const PASS_THROUGH: ForwardDerivation
Pass-through: keep every flag.
Sourcepub const ANONYMOUS: ForwardDerivation
pub const ANONYMOUS: ForwardDerivation
Anonymous: keep no 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<ForwardDerivation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ForwardDerivation, <__D as Deserializer<'de>>::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 ==.Source§impl Serialize for ForwardDerivation
impl Serialize for ForwardDerivation
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for ForwardDerivation
impl Eq for ForwardDerivation
impl StructuralPartialEq for ForwardDerivation
Auto Trait Implementations§
impl Freeze for ForwardDerivation
impl RefUnwindSafe for ForwardDerivation
impl Send for ForwardDerivation
impl Sync for ForwardDerivation
impl Unpin for ForwardDerivation
impl UnsafeUnpin for ForwardDerivation
impl UnwindSafe for ForwardDerivation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.