Skip to main content

DelegateStep

Struct DelegateStep 

Source
pub struct DelegateStep {
    pub plugin_name: String,
    pub config_override: Option<Value>,
    pub on_error: Option<String>,
    pub source: String,
}
Expand description

One delegation invocation inside policy: or post_policy:.

At runtime the apl-cpex DelegationInvoker constructs a cpex_core::delegation::DelegationPayload from

  • the inbound bearer token (pulled from Extensions.raw_credentials.inbound_tokens),
  • this step’s args (target / audience / permissions / mode / attenuation, layered over the plugin’s configured defaults),
  • extensions-derived context (subject, prior delegation chain),

then calls manager.invoke_entries::<TokenDelegateHook>(...). On success the resulting delegated_token is written into Extensions.raw_credentials.delegated_tokens.* and the granted scopes / audience surface as delegation.granted.* attributes in the policy bag for downstream rules to inspect.

args is a free-form map because each delegation backend has its own typed config shape; apl-core treats it as opaque and hands it to the plugin via the existing per-call config-override pathway.

§Multiple delegate(...) in one phase (most-recent-wins)

Multiple delegate(...) steps in the same phase are supported — each fires independently, each contributes to Extensions (raw_credentials.delegated_tokens is a HashMap keyed on audience+scope+mode so tokens accumulate; delegation.chain grows with each hop). But the delegation.granted.* bag keys are overwritten on each call — only the most recent delegate’s grants are queryable from downstream require(...) rules.

For fan-out flows that need multiple independently-queryable grants, split into policy: + post_policy: or reach for a future per-step as: alias (not in v0; see the design doc’s “Open design questions” section).

Fields§

§plugin_name: String

Plugin name — must reference an entry in the top-level plugins: block that registers under the token.delegate hook.

§config_override: Option<Value>

Per-call config overrides applied for this delegation only. Layered on top of the plugin’s default config; the framework’s build_override_entries plumbing handles the merge. Common keys: target, audience, permissions, mode, attenuation. Schema is plugin-defined.

§on_error: Option<String>

deny | continue — what to do when the plugin returns a deny (e.g. IdP refusal, network error). None defaults to "deny" (fail-closed; matches PDP step semantics).

§source: String

Human-readable source path (e.g. "route.get_compensation.policy[2]") — used in audit and Decision::Deny.rule_source when the step denies.

Trait Implementations§

Source§

impl Clone for DelegateStep

Source§

fn clone(&self) -> DelegateStep

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DelegateStep

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DelegateStep

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for DelegateStep

Source§

fn eq(&self, other: &DelegateStep) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DelegateStep

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DelegateStep

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.