Skip to main content

GitLab 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_gitlab Discord

Swarmauri Auth IDP GitLab

GitLab OAuth 2.0 / OAuth 2.1 / OIDC 1.0 identity providers and app clients packaged for Swarmauri deployments.

Features

  • Authorization Code flows with PKCE and HMAC-signed state payloads for GitLab SaaS or self-managed.
  • Discovery-driven OAuth 2.1 & OIDC login that validates ID tokens and hydrates profile details.
  • Client credentials helpers that support shared secrets and JWT assertions.
  • Retry-aware HTTP integration with GitLab REST API v4 and OIDC endpoints.
  • ComponentBase-compatible models registered under swarmauri.auth_idp entry points.

Installation

pip

pip install swarmauri_auth_idp_gitlab

uv (project)

uv add swarmauri_auth_idp_gitlab

uv (environment)

uv pip install swarmauri_auth_idp_gitlab

Usage

import asyncio
from pydantic import SecretBytes, SecretStr
from swarmauri_auth_idp_gitlab import GitLabOAuth20Login

login = GitLabOAuth20Login(
    base_url="https://gitlab.example",
    client_id="gitlab-client-id",
    client_secret=SecretStr("gitlab-client-secret"),
    redirect_uri="https://app.example.com/callback",
    state_secret=SecretBytes(b"replace-with-random-bytes"),
)

async def run_flow() -> None:
    auth = await login.auth_url()
    print(auth["url"])
    # Redirect the browser to `auth["url"]`, then capture the callback `code` and `state`.
    # Later, call `login.exchange_and_identity(code, state)` inside your callback handler.

asyncio.run(run_flow())

Workflow Summary

  1. Call auth_url() and redirect the browser to the returned URL.
  2. Persist the state and verify it during the callback handler.
  3. Exchange the authorization code through exchange_and_identity() to obtain tokens and profile metadata.
  4. Instantiate GitLabOAuth21AppClient or GitLabOIDC10AppClient to fetch service tokens for background jobs.

Entry Points

  • swarmauri.auth_idp:GitLabOAuth20Login
  • swarmauri.auth_idp:GitLabOAuth21Login
  • swarmauri.auth_idp:GitLabOIDC10Login
  • swarmauri.auth_idp:GitLabOAuth20AppClient
  • swarmauri.auth_idp:GitLabOAuth21AppClient
  • swarmauri.auth_idp:GitLabOIDC10AppClient

Contributing

To contribute to swarmauri-sdk, review the guidelines for contributing which cover 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_gitlab-0.11.0.dev2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_auth_idp_gitlab-0.11.0.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_auth_idp_gitlab-0.11.0.dev2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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_gitlab-0.11.0.dev2.tar.gz
Algorithm Hash digest
SHA256 9e96856565b73b439e49d5601f2f4b905dbce2bf19442d5eaf1f969851d61fd0
MD5 7bf7814dfbfa8958e58d432ed4455577
BLAKE2b-256 d4d4d5a675086a6ae15363294951e5f263c57271845cb18adc6d1f03af014cd2

See more details on using hashes here.

File details

Details for the file swarmauri_auth_idp_gitlab-0.11.0.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_auth_idp_gitlab-0.11.0.dev2-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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_gitlab-0.11.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 49fbd2c30670c6d5123453e3f24af1c67c9a76af9e675f0c13c8ce21f905f4f6
MD5 373fb57f08183e123a57e09ae6d04db3
BLAKE2b-256 6ba280e03eff23ab0d11844c8e4d94ee26515e351841b63563e3cee97e9acbd2

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