Skip to main content

Gitea OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity provider implementations for Swarmauri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_auth_idp_gitea


Swarmauri Auth IDP Gitea

Gitea OAuth 2.0, OAuth 2.1, and OIDC 1.0 login and app-client flows packaged for the Swarmauri ecosystem.

Features

  • PKCE-enabled authorization code flows with signed state payloads and resilient retries.
  • Automatic profile enrichment using the Gitea REST API with email fallbacks.
  • Optional private-key JWT client authentication for high-assurance machine-to-machine use.
  • OIDC support that validates ID tokens and gracefully falls back to UserInfo claims.
  • ComponentBase-registered classes for discovery through Swarmauri plugin entry points.

Installation

pip

pip install swarmauri_auth_idp_gitea

uv (project)

uv add swarmauri_auth_idp_gitea

uv (environment)

uv pip install swarmauri_auth_idp_gitea

Usage

Instantiate the login classes with your Gitea base URL, client credentials, and redirect URI. Persist the signed state returned by auth_url and supply it to the exchange step.

from pydantic import SecretBytes, SecretStr
from swarmauri_auth_idp_gitea import GiteaOAuth21Login

login = GiteaOAuth21Login(
    base_url="https://gitea.example.com",
    client_id="example-client-id",
    client_secret=SecretStr("example-secret"),
    redirect_uri="https://example.com/callback",
    state_secret=SecretBytes(b"super-secret-state-key"),
)

# Within an async context:
# auth_payload = await login.auth_url()
# identity = await login.exchange_and_identity(code, auth_payload["state"])
print(login.client_id)

Expected Workflow

  1. Call auth_url() and redirect the user agent to Gitea's authorization endpoint.
  2. Persist the returned state and verify it during the callback to prevent tampering.
  3. Call exchange_and_identity() (or exchange() for the OIDC login) to normalize user claims.
  4. Use the normalized payload to create sessions, audit events, or downstream tokens.

App client classes expose access_token() for service-to-service integrations using either client secrets or private-key JWT assertions.

Entry Points

The distribution registers the following entry points:

  • swarmauri.auth_idp:GiteaOAuth20Login
  • swarmauri.auth_idp:GiteaOAuth21Login
  • swarmauri.auth_idp:GiteaOIDC10Login
  • swarmauri.auth_idp:GiteaOAuth20AppClient
  • swarmauri.auth_idp:GiteaOAuth21AppClient
  • swarmauri.auth_idp:GiteaOIDC10AppClient

Contributing

To contribute to swarmauri-sdk, review the guidelines for contributing covering development workflow, testing, and coding standards.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_auth_idp_gitea-0.2.0.dev5.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_auth_idp_gitea-0.2.0.dev5-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_auth_idp_gitea-0.2.0.dev5.tar.gz.

File metadata

  • Download URL: swarmauri_auth_idp_gitea-0.2.0.dev5.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_auth_idp_gitea-0.2.0.dev5.tar.gz
Algorithm Hash digest
SHA256 eb29cc7fa743d81cf1ac3647c5f0add9338e515b969610f16a3b700bc380b101
MD5 2bd9b71fec80e58d6efc3f8cfcad6efc
BLAKE2b-256 781829a97e49f7d00ab1fc12efff7f298203860b3df942a03d8b0cf0144f1c6d

See more details on using hashes here.

File details

Details for the file swarmauri_auth_idp_gitea-0.2.0.dev5-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_auth_idp_gitea-0.2.0.dev5-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_auth_idp_gitea-0.2.0.dev5-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2804149d89b2a52939db5d94779b61b7deeecf5404b33b935e945bcf5e6f79
MD5 f022553f1cfc639a3a07895cb6b8736e
BLAKE2b-256 e67d8ee1a04361750ac573ce79071334481919a2ee34a6ee12ea36e2d405b96a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page