Skip to content

API Reference parrot_formdesigner.services.auth_context

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.services.auth_context

View source

Runtime authentication context for per-request credential resolution.

This module defines AuthContext, the runtime auth context constructed by the aiohttp handler on each request. It is distinct from core.auth.AuthConfig (the schema-side declaration) — AuthContext carries resolved credentials and is passed explicitly to OptionsLoader.fetch(), RemoteResponseResolver.resolve(), and renderers.

Cascade behaviour: the same AuthContext instance flows into nested GROUP and ARRAY field rendering without re-resolution.

Class AuthContext

Runtime auth context constructed by the aiohttp handler per request.

Distinct from core.auth.AuthConfig which is the schema-side declaration. AuthContext carries resolved credentials and is passed explicitly to OptionsLoader.fetch() / RemoteResponseResolver.resolve() / renderers.

Cascade: the same AuthContext flows into nested GROUP / ARRAY field rendering without re-resolution.

Fields:

Field Type Default Description
scheme Literal['none', 'bearer', 'api_key', 'custom'] Auth scheme identifier — "none", "bearer", "api_key", or "custom".
token str | None None Bearer token or API key value. None if not applicable.
headers dict[str, str] {} Raw outbound HTTP headers (pre-built for "custom" scheme).
claims dict[str, Any] {} Parsed JWT claims if available (e.g., for scope-checking).

Method AuthContext.resolve_for

Return outbound HTTP headers for the given auth_ref.

If auth_ref matches one of the known token env-var references in self.claims, returns the appropriate header. Falls back to self.headers if auth_ref is None or unrecognized.

resolve_for(auth_ref: str | None) -> dict[str, str]

Parameter Type Default Description
auth_ref str | None Optional string key identifying which auth credentials to use. Typically matches the auth_ref field on an OptionsSource or RemoteResponseField.

Returns: dict[str, str] — Dict of HTTP headers to include in outbound requests. Returns {} if scheme is "none" or auth_ref is None.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally