Skip to content

feat: investigate agent-side token propagation for per-user authorization at tools #174

Description

@mrsabath

Problem

AuthBridge supports two outbound token acquisition modes:

  1. Token Exchange (RFC 8693) — preserves the end user's identity (sub claim) when the outbound request carries an Authorization header
  2. Client Credentials fallback (feat: add client_credentials fallback for outbound requests without Authorization header #171) — uses the agent's own SPIFFE identity when no Authorization header is present

Currently, agent frameworks (A2A SDK, LangChain, LlamaIndex) do not propagate the inbound Bearer token to outbound tool calls. The agent receives the user's token, processes the prompt with an LLM, and makes fresh HTTP calls without any Authorization header. This means the client_credentials path is always used, and the tool cannot distinguish which user triggered the call.

Desired Behavior

When Alice sends a request to an agent that calls a tool, the tool should receive a token with sub=alice (not sub=agent-spiffe-id). This enables:

  • Per-user authorization at the tool level
  • Accurate audit trails
  • Scope-based access differentiation per user (e.g., Alice gets public access, Bob gets privileged)

Investigation Areas

Short-term: A2A SDK token propagation

Investigate whether the A2A SDK can be extended to:

  1. Capture the inbound Authorization: Bearer <token> from the HTTP request
  2. Store it in a request-scoped context (per-request, not global)
  3. Inject it into outbound HTTP calls made during that request's processing

Key challenges:

  • Concurrency — a shared agent handles multiple users simultaneously. The framework must correctly associate each outbound call with the right inbound user.
  • Framework diversity — different agent frameworks (A2A SDK, LangChain, CrewAI) have different tool-calling abstractions.

Long-term: IETF Transaction Tokens for Agents

Two IETF drafts define tokens that carry both agent and user identity:

These would allow AuthBridge to issue tokens that identify both the agent AND the user, eliminating the trade-off between the two current modes.

Current Workaround

PR #171 implements the client_credentials fallback. The code structure already prefers token exchange when an Authorization header is present — so if the agent framework starts propagating tokens, token exchange activates automatically with no AuthBridge code changes.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions