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.dev1.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.

swarmauri_auth_idp_gitlab-0.11.0.dev1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: swarmauri_auth_idp_gitlab-0.11.0.dev1.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.dev1.tar.gz
Algorithm Hash digest
SHA256 0c4d1017bc4a01d3b3d24159a584dc989f1e3a0d1bef94d7c6572cedd36381a3
MD5 0101dddf289ccfb9b484347b0840cfb5
BLAKE2b-256 4fed6cb501d9b360cd157ba3518837f4ee7a4f008194a634fef1f5b49d866618

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_auth_idp_gitlab-0.11.0.dev1-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.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 577b59b7cc5f1fe4a27ce60f5f25472f15f545e1ce018c3d8a33720d3e452102
MD5 6e8e115c791176909bad946f75aee02d
BLAKE2b-256 737ee7bc65cbae5f3c99a6968726fa20807486ea3ef73238e009f1e2cb540b0d

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