Skip to main content

GGID IAM Platform Python SDK — JWT verification, RBAC, user management

Project description

GGID Python SDK

PyPI version License: Apache 2.0

Python SDK for GGID IAM Platform — JWT verification, user management, and RBAC permission checking.

Features

  • JWT Verification: Verify RS256 JWTs from GGID Gateway with JWKS caching
  • FastAPI Middleware: Drop-in authentication for FastAPI apps
  • Django Middleware: Authentication decorator for Django views
  • Flask Decorator: @requires_auth decorator for Flask routes
  • Permission Checking: Check user roles and permissions via GGID Policy API
  • User Management: CRUD operations via GGID Identity API
  • Async Support: Full async/await support with httpx

Installation

pip install ggid

Quick Start

FastAPI

from fastapi import FastAPI, Depends
from ggid import GGIDMiddleware, get_current_user

app = FastAPI()
app.add_middleware(
    GGIDMiddleware,
    gateway_url="https://iam.example.com",
    jwks_url="https://iam.example.com/.well-known/jwks.json",
    tenant_id="00000000-0000-0000-0000-000000000001",
)

@app.get("/profile")
async def profile(user = Depends(get_current_user)):
    return {"user": user}

Flask

from flask import Flask, jsonify
from ggid.flask import requires_auth

app = Flask(__name__)
app.config["GGID_GATEWAY_URL"] = "https://iam.example.com"
app.config["GGID_TENANT_ID"] = "00000000-0000-0000-0000-000000000001"

@app.route("/profile")
@requires_auth
def profile(user):
    return jsonify({"user": user})

Django

# settings.py
GGID_GATEWAY_URL = "https://iam.example.com"
GGID_TENANT_ID = "00000000-0000-0000-0000-000000000001"

# views.py
from ggid.django import ggid_login_required

@ggid_login_required
def profile(request):
    return JsonResponse({"user": request.ggid_user})

Permission Check

from ggid import GGIDClient

client = GGIDClient(
    gateway_url="https://iam.example.com",
    tenant_id="00000000-0000-0000-0000-000000000001",
)

# Check if user can perform action on resource
allowed = await client.check_permission(
    user_id="abc-123",
    resource="documents:sensitive",
    action="read",
)

License

Apache 2.0

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

ggid-1.0.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

ggid-1.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file ggid-1.0.1.tar.gz.

File metadata

  • Download URL: ggid-1.0.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ggid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8a0a745c5cfd714d86a5cce356d596f8fb4052b48238bf33a14c6ab4d4350e80
MD5 36f23a89246f0711a22b8ef2070d5cb5
BLAKE2b-256 02c54b057383266752bb784befa3112a3a151dbb4cda32e570bbdf3857fbcfbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggid-1.0.1.tar.gz:

Publisher: publish.yml on topcheer/ggid-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggid-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ggid-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for ggid-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc58e011a8bad491f2a456a1e1e1c72168cf3805eac5d8cfc05f59fb9a7d4c25
MD5 d516378996c595cc6fa7ecdc585ac42d
BLAKE2b-256 c6955d2ba1d3c03e9b613c0ef960b554a1fc2b5cf07144cb3a5e868453b417bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggid-1.0.1-py3-none-any.whl:

Publisher: publish.yml on topcheer/ggid-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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