Skip to main content

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.

JWKSVerifier(ttl=...) applies one lifetime to both the JWKS document and its parsed public keys. Unexpired documents reuse keys; expiry refreshes before a known key can be trusted again. ttl=0 disables both caches. Removed keys and same-kid replacements take effect on refresh; a refresh failure raises AuthError rather than falling back to stale signing material.

License

BSD-3-Clause.

Metadata

Release files for semql-auth 0.14.0

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

Source distribution (sdist)

Source distribution for semql-auth 0.14.0
File Size Uploaded Provenance
semql_auth-0.14.0.tar.gz 12.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for semql-auth 0.14.0
File Interpreter ABI Platform
semql_auth-0.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / semql_auth-0.14.0.tar.gz

Download URL semql_auth-0.14.0.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a83a27f906e2fdcfcb5b08e050ab9e811e608813eaf6366c0290ac6c0acee4db
BLAKE2b-256 checksum
How to use checksums
a183190ea6b154a3a79df74c2dc1eb395412fbabd8db088415d94d5098e30a78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / semql_auth-0.14.0-py3-none-any.whl

Download URL semql_auth-0.14.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9102e0e99ba8d4c43219051b4abb170bcc10942abc0de8db8695fba76724248a
BLAKE2b-256 checksum
How to use checksums
63a127583ae4cca99818117f643156a5620389cd6f7617f0bfc24d3f1ed62264
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for semql-auth 0.14.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for semql_auth-0.14.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

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.

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