Skip to content

API Reference parrot.auth.principal

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

parrot.auth.principal

View source

Platform principal for delegated connections (FEAT-773, spec §2).

A connection belongs to the Navigator user (auth.users.user_id), never to a (channel, channel_user_id) pair. Core defines the resolver seam; the server registers an implementation over auth.user_identities at startup.

Class Principal

The platform identity a connection belongs to (U1).

Fields:

Field Type Default Description
user_id str Navigator auth.users.user_id serialized as str.
canonical_identity Optional[str] None Entra OID or lower-cased e-mail, when known.
tenant_id Optional[str] None Optional tenant.
channel str Originating channel (web, telegram, slack, msteams, a2a, cli).
channel_user_id str Raw id on that channel.

Class PrincipalResolver

Maps (channel, channel_user_id) to a :class:Principal.

Method PrincipalResolver.resolve

Return the bound principal, or None (the caller fails closed).

resolve(channel: str, channel_user_id: str) -> Optional[Principal]

Parameter Type Default Description
channel str
channel_user_id str

Returns: Optional[Principal]

Class WebPrincipalResolver

Default resolver: on web the id IS the Navigator id; other channels resolve to None.

Method WebPrincipalResolver.resolve

Resolve web ids only.

resolve(channel: str, channel_user_id: str) -> Optional[Principal]

Parameter Type Default Description
channel str
channel_user_id str

Returns: Optional[Principal]

Function get_principal_resolver

Return the registered resolver, or :class:WebPrincipalResolver.

get_principal_resolver() -> PrincipalResolver

Returns: PrincipalResolver

Attribute logger

Function resolve_principal

Resolve through the registered resolver; None means "no principal" — never fall back to channel keys.

resolve_principal(channel: str, channel_user_id: str) -> Optional[Principal]

Parameter Type Default Description
channel str
channel_user_id str

Returns: Optional[Principal]

Function set_principal_resolver

Register the process-wide resolver (server calls this at startup; None restores the default).

set_principal_resolver(resolver: Optional[PrincipalResolver]) -> None

Parameter Type Default Description
resolver Optional[PrincipalResolver]

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