simple_module_auth
Pluggable authentication core for simple_module apps. Owns the stable public contracts every other module imports — UserContext, the AuthProvider protocol, the PrincipalResolver chain, and the get_current_user / CurrentUser / require_permission dependencies — plus the AuthMiddleware that resolves the current principal on every request.
Heads up: for most apps you don't install this directly — an auth-provider module (simple_module_users for email+password, simple_module_keycloak for OIDC) pulls it in and registers itself on app.state.auth.auth_provider.
Install
pip install simple_module_auth
What it provides
UserContext— the request-scoped principal (id,name,email,roles).AuthProviderprotocol — the swappable-backend contract (resolve_user,get_login_url,get_logout_url,is_bearer_request); exactly one provider module registers an implementation onapp.state.auth.auth_provider.PrincipalResolverchain — async(Request) -> UserContext | Nonecallables apps append toapp.state.auth.principal_resolvers(e.g. PAT/bearer-token or API-key auth), consulted after the session path.AuthMiddleware— delegates to the provider + resolver chain on every request and populates the request principal.get_current_user/CurrentUserdependency and therequire_permission(*permissions)dependency factory.- Anonymous-access is declared via the framework's method-aware
register_public_routeshook (with theSM_AUTH_PUBLIC_PATHShost-level escape hatch).
Usage
from fastapi import APIRouter
from auth.deps import CurrentUser
router = APIRouter()
@router.get("/me")
async def me(user: CurrentUser):
return {"user_id": user.id, "email": user.email}
Routes that need a specific permission use the require_permission(...) dependency factory:
from fastapi import Depends
from auth.deps import require_permission
@router.post("/", dependencies=[Depends(require_permission("products.create"))])
async def create_product(): ...
Depends on
simple_module_core,simple_module_dbitsdangerous
License
MIT — see LICENSE.
Metadata
Release files for simple-module-auth 0.0.38
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| simple_module_auth-0.0.38.tar.gz | 20.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_module_auth-0.0.38-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.4 kB
Release files / simple_module_auth-0.0.38.tar.gz
| Download URL | simple_module_auth-0.0.38.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94ab75dbb87352492bd7361525209ab4d95eecae7408fda3117f5ccd2bdd2ecb
|
|
BLAKE2b-256 checksum How to use checksums |
5485ee7b0bbf5b705e9c396fa91c99cef1918777df0668573171bd2966bca2f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 logRelease files / simple_module_auth-0.0.38-py3-none-any.whl
| Download URL | simple_module_auth-0.0.38-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08a8e28b3d5856440eccac44033f66483bdf2b524bf59fc8477f443e81e69a4d
|
|
BLAKE2b-256 checksum How to use checksums |
67772798cd7118ef8feaa7345c710f5d893c5ca6162932b27f16960050d00f50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 logSecurity for simple-module-auth 0.0.38
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.
Attestation for simple_module_auth-0.0.38.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 logA 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.