Skip to main content

Credential→identity adapters for semql: bearer-token verifiers (HMAC, JWKS, introspection) and mappers (dict, mTLS x509) that produce a semql AuthContext.

Project description

semql-auth

Credential→identity adapters for semql.

semql threads an AuthContext (identity + roles) through Catalog.compile(viewer=...) to enforce required_roles cube/field visibility and security_sql row-level scoping. This package turns a transport credential into that AuthContext:

  • TokenVerifier — verify a bearer token and return its claims.
    • HMACVerifier — symmetric HS256/384/512.
    • JWKSVerifier — asymmetric RS/ES, fetching keys from a JWKS URL (needs the jwks extra: pip install semql-auth[jwks]).
  • TokenMapper — map a verified credential to an AuthContext.
    • DictMapper — static, in-memory token → AuthContext table.
    • IntrospectMapper — OAuth2 token introspection (introspect extra).
    • X509Mapper — derive identity from an mTLS client cert subject / SAN (the reference cryptography decoder needs the x509 extra).

AuthContext itself lives in semql.model — the compiler depends on it, so it stays in the pure core. This package holds only the adapters, which carry optional third-party dependencies (PyJWT, httpx, cryptography) that the core shouldn't.

Install

pip install semql-auth
pip install semql-auth[jwks]        # JWKS verifier (httpx)
pip install semql-auth[introspect]  # OAuth2 introspection
pip install semql-auth[x509]        # mTLS client cert decoder

Quick start

from semql import Catalog
from semql_auth import HMACVerifier, DictMapper

verifier = HMACVerifier(secret="...")
mapper = DictMapper({"tok-abc": ...})
# In your transport: verify the token, map to AuthContext, then
#   catalog.compile(query, viewer=auth_context)

See API reference for the full adapter surface.

License

BSD-3-Clause.

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

semql_auth-0.7.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

semql_auth-0.7.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file semql_auth-0.7.0.tar.gz.

File metadata

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

File hashes

Hashes for semql_auth-0.7.0.tar.gz
Algorithm Hash digest
SHA256 fa436de500c70ea4261d6d717cba53ebff0cafb87d49ed6d264f05278b66225b
MD5 4f4428b46a3c943776fd005619f3cbf3
BLAKE2b-256 3ae9217067131a9b889b0c77b542e8f8c8d70b391134f1102bff206df651348d

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_auth-0.7.0.tar.gz:

Publisher: release.yml on semql-io/semql

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

File details

Details for the file semql_auth-0.7.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for semql_auth-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7370ebf60e5a83167e1f623a4d7a17b89a9236e7c8b601ee91b94750b2d9e11c
MD5 d8f9bc4b412bdf0e4116e92794cd3b7b
BLAKE2b-256 1d1c0428df6b3a3549dfb6b09d511e30ef090b4da810a6cebb1dbe41d33403f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_auth-0.7.0-py3-none-any.whl:

Publisher: release.yml on semql-io/semql

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