Skip to content

API Reference parrot.auth.oauth2.descriptor

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

parrot.auth.oauth2.descriptor

View source

Typed OAuth2 provider descriptors (FEAT-773 M3, S10).

Descriptors are data; provider-specific post-exchange behaviour is a Python callable registered by name. Client credentials never live in a descriptor — they come from navconfig OAUTH2_<PROVIDER>_*.

Alias AbstractOAuth2Manager

Re-exported from parrot.auth.oauth2_base.AbstractOAuth2Manager.

Alias AbstractOAuth2TokenSet

Re-exported from parrot.auth.oauth2_base.AbstractOAuth2TokenSet.

Alias ConnectionEventPublisher

Re-exported from parrot.auth.oauth2.events.ConnectionEventPublisher.

Alias CredentialStore

Re-exported from parrot.auth.oauth2_base.CredentialStore.

Class DescriptorOAuth2Provider

Registry entry backed by a descriptor and StandardOAuth2Manager.

Parameter Type Default Description
descriptor OAuth2ProviderDescriptor
manager StandardOAuth2Manager
toolkit_factory_fn Optional[Callable[[Any], Any]] None

Attributes:

Attribute Type Description
manager StandardOAuth2Manager Return the descriptor-backed manager.

Method DescriptorOAuth2Provider.toolkit_factory

Return None unless a factory was supplied.

toolkit_factory(credential_resolver: Any) -> Any

Parameter Type Default Description
credential_resolver Any

Returns: Any

Alias DeviceAuthorization

Re-exported from parrot.auth.oauth2.device_code.DeviceAuthorization.

Alias DeviceCodeError

Re-exported from parrot.auth.oauth2.device_code.DeviceCodeError.

Class IdentityProbe

Fields:

Field Type Default Description
url str
account_id_path str
display_name_path Optional[str] None
email_path Optional[str] None

Alias InvalidGrantError

Re-exported from parrot.auth.oauth2_base.InvalidGrantError.

Alias OAuth2Provider

Re-exported from parrot.auth.oauth2.registry.OAuth2Provider.

Class OAuth2ProviderDescriptor

Fields:

Field Type Default Description
provider_id str
display_name str
icon str ''
authorization_url str
token_url str
revoke_url Optional[str] None
default_scopes List[str]
client_type Literal['confidential', 'public'] 'confidential'
pkce Literal['required', 'optional', 'none'] 'required'
refresh_policy RefreshPolicy
identity_probe Optional[IdentityProbe] None
extra_authorize_params Dict[str, str]
post_exchange Optional[str] None
pbac_action_namespace str 'integration'
device_authorization_url Optional[str] None

Attribute PostExchangeHook

Class PostExchangeHookRegistry

Typed in-code registry of post-exchange hooks (S10). Never imports by path.

Method PostExchangeHookRegistry.register

Register a callable under a non-empty hook name.

register(name: str, fn: PostExchangeHook) -> None

Parameter Type Default Description
name str
fn PostExchangeHook

Method PostExchangeHookRegistry.get

Return the hook; raise KeyError naming it when unknown.

get(name: str) -> PostExchangeHook

Parameter Type Default Description
name str

Returns: PostExchangeHook

Alias Principal

Re-exported from parrot.auth.principal.Principal.

Class RefreshPolicy

Informational refresh facts (R6). A returned refresh_token ALWAYS replaces the stored one.

Fields:

Field Type Default Description
rotating bool False
sliding bool False
refresh_lifetime_s Optional[int] None
access_lifetime_s Optional[int] None

Alias RefreshTransientError

Re-exported from parrot.auth.oauth2_base.RefreshTransientError.

Alias SLOW_DOWN_INCREMENT_S

Re-exported from parrot.auth.oauth2.device_code.SLOW_DOWN_INCREMENT_S.

Class StandardOAuth2Manager

Descriptor-driven RFC 6749 manager: endpoints, scopes, PKCE, extra params, probe, hook, revoke.

Parameter Type Default Description
descriptor OAuth2ProviderDescriptor
client_id str
client_secret Optional[str]
redirect_uri str
hooks Optional[PostExchangeHookRegistry] None
**manager_kwargs Any {}

Method StandardOAuth2Manager.authorization_url_extra_params

Return descriptor-defined authorization parameters.

authorization_url_extra_params() -> Dict[str, str]

Returns: Dict[str, str]

Method StandardOAuth2Manager.start_device_authorization

Start an RFC 8628 grant for principal and return its handle and authorization.

start_device_authorization(principal: Principal, *, scopes: Optional[List[str]] = None) -> Tuple[str, DeviceAuthorization]

Parameter Type Default Description
principal Principal
scopes Optional[List[str]] None

Returns: Tuple[str, DeviceAuthorization]

Method StandardOAuth2Manager.complete_device_authorization

Poll one device grant and return its pending, completed, failed, or expired result.

complete_device_authorization(handle: str) -> Dict[str, Any]

Parameter Type Default Description
handle str

Returns: Dict[str, Any]

Function load_provider_descriptors

Load descriptors from a YAML file (OAUTH2_PROVIDERS_FILE) or mappings.

load_provider_descriptors(source: Union[str, Path, Sequence[Mapping[str, Any]]]) -> List[OAuth2ProviderDescriptor]

Parameter Type Default Description
source Union[str, Path, Sequence[Mapping[str, Any]]]

Returns: List[OAuth2ProviderDescriptor]

Raises:

  • ValueError — invalid entry (message names the provider_id) or duplicate provider_id.

Attribute logger

Attribute post_exchange_hooks

Function register_descriptor_providers

Build and register configured descriptor providers.

register_descriptor_providers(descriptors: Sequence[OAuth2ProviderDescriptor], *, app: Any, credential_store: Optional[CredentialStore], event_publisher: Optional[ConnectionEventPublisher]) -> List[DescriptorOAuth2Provider]

Parameter Type Default Description
descriptors Sequence[OAuth2ProviderDescriptor]
app Any
credential_store Optional[CredentialStore]
event_publisher Optional[ConnectionEventPublisher]

Returns: List[DescriptorOAuth2Provider]

Alias register_oauth2_provider

Re-exported from parrot.auth.oauth2.registry.register_oauth2_provider.

Alias request_device_authorization

Re-exported from parrot.auth.oauth2.device_code.request_device_authorization.

Alias request_device_token

Re-exported from parrot.auth.oauth2.device_code.request_device_token.

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