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.2.tar.gz (13.4 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.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ggid-1.0.2.tar.gz
  • Upload date:
  • Size: 13.4 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.2.tar.gz
Algorithm Hash digest
SHA256 876bcacd012f73d5f2f2106d26fd36eacb7aa2586ce2db17cc2d68f4fab8b7b6
MD5 0ace67e1045e4263f09b14be2aaf2483
BLAKE2b-256 2659817b92d30ccb97c69bdedbb3cfa642fab2f86ed3694c27e88001310a2403

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggid-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: ggid-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3ec6fe0d1cd0f911f04464be5b01bf3c398fa3cdef15c10dc448a722e14b8910
MD5 787fe3f3bc06c2cfb42f7100326f74c5
BLAKE2b-256 f8d416c82ff26ca649655449b32984b2ecfd823f68f437d91d0ab5265f44b36c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggid-1.0.2-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