Skip to main content

attach_credential_for_payload

Function attach_credential_for_payload 

Source
pub fn attach_credential_for_payload(
    task: &mut Value,
    hook_name: &str,
    payload: &dyn PluginPayload,
    extensions: &Extensions,
    capabilities: &HashSet<String>,
) -> Result<(), HostError>
Expand description

Attach the credential object for this invocation’s payload.

The entry point the adapter uses. PPE’s own payloads carry the credential themselves: IdentityPayload holds the inbound token (in raw_token, or in its source header when a host deserialized it), and DelegationPayload holds the caller’s bearer token. For those the token is read from the payload, because it is the credential the hook is about; an extensions token could belong to a different principal. Any other payload goes through attach_credential and the extensions view.

The gate is the same either way: no declared capability means no DTO, and a declared capability with no usable token is an error.