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.5.0.tar.gz (11.7 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.5.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: semql_auth-0.5.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for semql_auth-0.5.0.tar.gz
Algorithm Hash digest
SHA256 6eee7265d877df97203172ea1b36b5341a3d4c67472f40bd15c2010cc9080e9e
MD5 b74e59d5469aa5e40eeb9b00ec7c34ef
BLAKE2b-256 a155c18d15b19fefa21e7d690fb4d034ae9f3430a796ac507280becdaeb6e2ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: semql_auth-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for semql_auth-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b62aa1a54af625f44d15f473103d518179b49807ea0f829a80af4ac591bfc14
MD5 2f4613f2fc796cc39cda52fc18e1b28a
BLAKE2b-256 67c353435732397a6a2b53e44ba72842e86bc18177efb638e18dfb7c77429b0c

See more details on using hashes here.

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