Skip to content

API Reference parrot.auth.identity

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

parrot.auth.identity

View source

Canonical identity mapper for cross-surface credential reuse.

Normalises per-surface raw identity data to a single canonical vault key so credentials captured on A2A are honoured in MSAgentSDK chat (and any other surface) without re-authentication.

Precedence: Entra OID (UUID) → email (lower-cased) → None (fail closed).

Class CanonicalIdentityMapper

Maps raw per-surface identity data to a single canonical vault key.

The canonical key is used as the user_id parameter when the broker looks up credentials in the vault. Credentials stored under one surface are automatically reusable on any other surface that resolves to the same canonical key.

Precedence (most stable → least stable):

  1. Entra OID (UUID string) — stable across surface changes and email renames.
  2. Email address (lower-cased) — stable across surfaces but not renames.
  3. None — anonymous / development identity; callers must fail closed.

The mapper is stateless; call :meth:to_canonical directly or use the module-level singleton :data:identity_mapper.

Method CanonicalIdentityMapper.to_canonical

Map a raw identity dict to a canonical vault key.

Accepts a flat or lightly-nested dict produced by any surface extractor (A2A server, MSAgentSDK agent, etc.). Unknown keys are silently ignored.

to_canonical(raw_identity: Dict[str, Any]) -> Optional[str]

Parameter Type Default Description
raw_identity Dict[str, Any] Mapping produced by the surface layer. Supported key layouts: * A2A (from A2AServer._extract_identity precedents): {"from_id": "<uuid>", "from_email": "alice@corp.com", "x-ms-user-email": "...", "sender": "..."} * MSAgentSDK (from ParrotM365Agent._extract_user_id precedents): {"aad_object_id": "<uuid>", "email": "..."}

Returns: Optional[str] — Canonical key string: - The Entra OID (lower-cased UUID) when found in any OID field. - The lower-cased email when no OID is present. - None when neither can be found — the caller must fail closed and refuse to resolve credentials.

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