Session-cookie authentication primitives — middleware, login/logout, redirect helpers for simple_module
Project description
simple_module_auth
Session-cookie authentication primitives for simple_module apps. Provides the SessionMiddleware wiring, login/logout helpers, and login-redirect handling used by the simple_module_users module.
Heads up: for most apps you don't install this directly — simple_module_users pulls it in and builds the email+password auth flow on top of these primitives.
Install
pip install simple_module_auth
What it provides
- Starlette
SessionMiddlewareconfiguration readingSM_SECRET_KEYandSM_SESSION_COOKIE_*env vars. current_user_idFastAPI dependency reading the signed session cookie.- Redirect-to-login helpers for unauthenticated requests on Inertia routes.
- Login-required decorator / dependency for protecting routes without pulling in the heavier
simple_module_userspackage.
Usage
from fastapi import APIRouter, Depends
from simple_module_auth import require_login
router = APIRouter()
@router.get("/me")
async def me(user_id: int = Depends(require_login)):
return {"user_id": user_id}
Routes that need more than just "logged in" (e.g. role/permission checks) should use simple_module_permissions instead.
Depends on
simple_module_core,simple_module_dbitsdangerous
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_module_auth-0.0.2.tar.gz.
File metadata
- Download URL: simple_module_auth-0.0.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09568f4872ab2cff7ae4cdfcb41744acb717d2ef01c3340ea3c4217a7b821582
|
|
| MD5 |
4e31c3a130a1a4f1047cd112dd519da5
|
|
| BLAKE2b-256 |
605407bfa5dfbd43a4952bef31de884d43ed136cb27947ab45481f5fd93562de
|
Provenance
The following attestation bundles were made for simple_module_auth-0.0.2.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_auth-0.0.2.tar.gz -
Subject digest:
09568f4872ab2cff7ae4cdfcb41744acb717d2ef01c3340ea3c4217a7b821582 - Sigstore transparency entry: 1391727911
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_auth-0.0.2-py3-none-any.whl.
File metadata
- Download URL: simple_module_auth-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78b7cc9b506d12e6413bd04dbb0de419e18f02fecc3c0abb30c56a2380e7d32a
|
|
| MD5 |
aa6d4f9944c5be17556cd41a8830ee74
|
|
| BLAKE2b-256 |
0c2c368a08dccbc3b407c71fca7a1fdb8556d3c281b2e29c28ce67065365e645
|
Provenance
The following attestation bundles were made for simple_module_auth-0.0.2-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_auth-0.0.2-py3-none-any.whl -
Subject digest:
78b7cc9b506d12e6413bd04dbb0de419e18f02fecc3c0abb30c56a2380e7d32a - Sigstore transparency entry: 1391727931
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type: