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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

empowernow_common-3.23.1.tar.gz (479.5 kB view details)

Uploaded Source

Built Distribution

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

empowernow_common-3.23.1-py3-none-any.whl (553.3 kB view details)

Uploaded Python 3

File details

Details for the file empowernow_common-3.23.1.tar.gz.

File metadata

  • Download URL: empowernow_common-3.23.1.tar.gz
  • Upload date:
  • Size: 479.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for empowernow_common-3.23.1.tar.gz
Algorithm Hash digest
SHA256 ded71cf04f0644fa6cede9ece2415e63c636a375e238968998c0c494304b43aa
MD5 444c5ef4e7a3ed1b3fca1f0e8e881228
BLAKE2b-256 d3785d43e93bc19e310f5c433f6fdfeb2668c03ef34e222d6ba6422ecdcbd283

See more details on using hashes here.

File details

Details for the file empowernow_common-3.23.1-py3-none-any.whl.

File metadata

File hashes

Hashes for empowernow_common-3.23.1-py3-none-any.whl
Algorithm Hash digest
SHA256 105f2fa9955e3554e635bfc0246ff761154e8f1aaaf9ebc7e5bc8c79b585be32
MD5 980c410543e049f53efaee69bed66ae9
BLAKE2b-256 5b5e01d1fe6a34d8ee34eb5e7c68f2808e11ed4fb411cf6be3fd37c5cd306962

See more details on using hashes here.

Release history Release notifications | RSS feed

3.23.3

2 files

3.23.2

2 files

This release

3.23.1 This release

2 files

3.22.3

2 files

3.22.2

2 files

3.22.1

2 files

3.22.0

2 files

3.21.0

2 files

3.20.0

2 files

3.19.0

2 files

3.18.0

2 files

3.17.0

2 files

3.16.0

2 files

3.15.0

2 files

3.14.1

2 files

3.14.0

2 files

3.13.6

2 files

3.13.5

2 files

3.13.4

2 files

3.13.3

2 files

3.13.2

2 files

3.13.1

2 files

3.13.0

2 files

3.12.2

2 files

3.12.1

2 files

3.12.0

2 files

3.11.1

2 files

3.9.0

2 files

3.8.0

2 files

3.7.1

2 files

3.7.0

2 files

3.6.0

2 files

3.5.0

2 files

3.4.11

2 files

3.4.10

2 files

3.4.9

2 files

3.4.8

2 files

3.4.6

2 files

3.4.5

2 files

3.4.4

2 files

3.4.3

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.0

2 files

3.2.0

2 files

3.1.0

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.9.0

2 files

2.8.0

2 files

2.7.0

2 files

2.6.0

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.32

2 files

2.3.31

2 files

2.3.30

2 files

2.3.29

2 files

2.3.28

2 files

2.3.27

2 files

2.3.26

2 files

2.3.25

2 files

2.3.24

2 files

2.3.23

2 files

2.3.22

2 files

2.3.21

2 files

2.3.20

2 files

2.3.19

2 files

2.3.18

2 files

2.3.17

2 files

2.3.16

2 files

2.3.14

2 files

2.3.13

2 files

2.3.12

2 files

2.3.11

2 files

2.3.10

2 files

2.3.9

2 files

2.3.8

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.3.4

2 files

2.3.3

2 files

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