Skip to content

API Reference parrot.auth.oauth2.registry

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

parrot.auth.oauth2.registry

View source

OAuth2 provider registry.

Defines the OAuth2Provider abstract base class and the OAuth2ProviderRegistry in-memory singleton. Providers register themselves at application startup via :func:register_oauth2_provider.

Alias AbstractToolkit

Re-exported from parrot.tools.AbstractToolkit.

Alias CredentialResolver

Re-exported from parrot.auth.credentials.CredentialResolver.

Class OAuth2Provider

Abstract base class for an OAuth2-capable provider.

Concrete implementations (e.g. JiraOAuth2Provider) declare their provider metadata as class-level attributes and implement the two abstract members.

Attributes:

Attribute Type Description
provider_id str Unique string key, e.g. "jira".
display_name str Human-readable name shown in the UI, e.g. "Jira".
icon Optional[str] Icon identifier (Material Design Icons key) or URL.
default_scopes List[str] Scopes requested during the OAuth consent screen.
pbac_action_namespace str PBAC action namespace for policy evaluation, e.g. "integration".
manager Any Return the underlying OAuth manager (e.g. JiraOAuthManager).

Method OAuth2Provider.toolkit_factory

Build a fresh toolkit instance bound to credential_resolver.

toolkit_factory(credential_resolver: 'CredentialResolver') -> 'AbstractToolkit'

Parameter Type Default Description
credential_resolver 'CredentialResolver' Resolver that the toolkit uses to retrieve valid tokens for the current user at call time.

Returns: 'AbstractToolkit' — A fully configured toolkit ready to be registered with the ToolManager.

Class OAuth2ProviderRegistry

In-memory singleton registry of :class:OAuth2Provider instances.

Usage::

registry = OAuth2ProviderRegistry()
registry.register(JiraOAuth2Provider())
provider = registry.get("jira")

The singleton is reset between test cases via :meth:_reset.

Method OAuth2ProviderRegistry.register

Register provider. A duplicate provider_id overwrites the previous entry.

register(provider: OAuth2Provider) -> None

Parameter Type Default Description
provider OAuth2Provider The provider instance to register.

Method OAuth2ProviderRegistry.get

Return the provider for provider_id, or None if not registered.

get(provider_id: str) -> Optional[OAuth2Provider]

Parameter Type Default Description
provider_id str The unique string key, e.g. "jira".

Returns: Optional[OAuth2Provider] — class:OAuth2Provider instance, or None.

Method OAuth2ProviderRegistry.all

Return all registered providers in insertion order.

all() -> List[OAuth2Provider]

Returns: List[OAuth2Provider] — List of all registered :class:OAuth2Provider instances.

Attribute logger

Function register_oauth2_provider

Module-level convenience for application startup.

Equivalent to::

OAuth2ProviderRegistry().register(provider)

register_oauth2_provider(provider: OAuth2Provider) -> None

Parameter Type Default Description
provider OAuth2Provider The provider to register with the global registry.

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