Skip to main content

EmpowerID Identity Fabric Common SDK

PyPI CI

The EmpowerID Identity Fabric Common SDK provides authentication helpers, configuration management and utilities shared across EmpowerID Identity Fabric micro-services and platform integrations.

pip install "empowernow-common[fastapi]"

Quick-start

Async OAuth

from empowernow_common import async_oauth

cfg = {
    "client_id": "svc",
    "client_secret": "***",
    "token_url": "https://auth.empowernow.io/oauth/token",
    "authorization_url": "https://auth.empowernow.io/oauth/authorize",
}

async with async_oauth(**cfg) as oauth:
    token = await oauth.get_token()
    print(token.access_token)

FastAPI integration

from fastapi import FastAPI, Depends
from empowernow_common.fastapi import build_auth_dependency

app = FastAPI()

# Create auth dependency for token validation
auth_dependency = build_auth_dependency(
    idps_yaml_path="/config/idps.yaml",
    default_idp_for_opaque="legacy"
)

@app.get("/protected")
async def protected_route(claims: dict = Depends(auth_dependency)):
    return {"user": claims["subject"]}

See the docs/ folder for full guides. For upgrading to the AuthZEN Draft‑04 API, read docs/authzen_migration_draft04.md.

Optional extras

  • redis – distributed caches
  • kafka – log sink and event bus
  • metrics – Prometheus client
  • fastapi – web-framework helpers

Development

git clone https://github.com/empowernow/empowernow-common.git
cd empowernow-common
pip install -e .[dev]
pre-commit install
pytest -q

Secret Loader

empowernow_common provides a zero-dependency helper to resolve secrets delivered as Docker/K8s secrets or environment variables.

from empowernow_common import load_secret

# read from /run/secrets/primary/db-password
password = load_secret("file:primary:db-password")

# read environment variable MY_API_KEY (dev only)
api_key = load_secret("env:MY_API_KEY")

Pointer grammar:

  • file:<instance>:<id> – Reads <mount>/<instance>/<id> where mount defaults to /run/secrets or $FILE_MOUNT_PATH.
  • filex:<instance>:<id> – Same as file: but returns rich structures: JSON objects or line-based key=value pairs are parsed into a dict.
  • env:<VAR> – Returns the environment variable value.

Providers are pluggable:

from empowernow_common.secret_loader import register_provider

def vault_provider(path: str):
    ...
register_provider("vault", vault_provider)

Audit: pass audit_hook to load_secret to stream access events to Kafka/SIEM.

Shared Kafka Producer

The SDK includes an optional, zero-config Kafka helper so services can publish structured events without re-implementing connection logic.

from empowernow_common.kafka.platform_producer import publish_structured
from empowernow_common.kafka.topics import TOPICS

await publish_structured(
    "pdp.decisions",                     # event_type
    {"decision": "allow", "id": "123"},  # payload (JSON-serialisable)
    topic=TOPICS["pdp.decisions"],       # canonical topic
    key="123"                            # partition key (optional)
)

Key points:

  • Optional dependency – install with pip install empowernow-common[kafka].
  • Reads KAFKA_BOOTSTRAP_SERVERS, SERVICE_NAME, KAFKA_ENABLED env vars.
  • No-ops automatically if Kafka is disabled or aiokafka isn’t installed.
  • empowernow_common.kafka.topics provides a central map so topic names evolve without touching every service.
  • Secret-access audit hook already uses the shared producer; you can register additional hooks via:
    from empowernow_common.kafka.platform_producer import publish
    

See kafka/platform_producer.py for full documentation and kafka/topics.py for the canonical topic list.


© EmpowerNow, Inc. MIT License

Metadata

Release files for empowernow-common 3.26.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for empowernow-common 3.26.1
File Size Uploaded Provenance Actions
empowernow_common-3.26.1.tar.gz 512.7 kB Without provenance Details for empowernow_common-3.26.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for empowernow-common 3.26.1
File Interpreter ABI Platform Actions
empowernow_common-3.26.1-py3-none-any.whl Python 3 none any Details for empowernow_common-3.26.1-py3-none-any.whl

Total release size: 1.1 MB

Release files / empowernow_common-3.26.1.tar.gz

Download URL empowernow_common-3.26.1.tar.gz
Size 512.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3f34193d8f7cbd1d5d8d60baeca3daa1fed0b5afb80711b0086afa19a35db784
BLAKE2b-256 checksum
How to use checksums
73f1e89889a32f047c492dc3cd817bf76e77dc9b420b4a5c6643064184a82a00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / empowernow_common-3.26.1-py3-none-any.whl

Download URL empowernow_common-3.26.1-py3-none-any.whl
Size 594.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
425aafc9c7e1f73e3bceecb278dcd77a8ad45905169ad630b8be53533370d09f
BLAKE2b-256 checksum
How to use checksums
6c1bc6f1cd50518b9eb7f53130e5afc7dba8e7f6807ce7506a98e56bd0366606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for empowernow-common 3.26.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.26.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page