IA Auth Sessions
Standard session-based authentication for FastAPI applications using secure signed cookies.
Features
- Signed Cookies: HMAC-SHA256 via
itsdangerousprevents tampering - Bcrypt Password Hashing: Industry standard with automatic salt generation via
pwdlib - Python 3.13+ Ready: Uses modern
pwdlibinstead of deprecatedpasslib - Secure Cookie Flags: HttpOnly, Secure, SameSite protection
- Session Management: Create, validate, destroy, and auto-cleanup
- Database Agnostic: PostgreSQL and SQLite via NexusQL
- WebSocket Support: Authenticate WebSocket connections
Available Routes
POST /auth/register- Register new userPOST /auth/login- Login and create sessionPOST /auth/logout- Logout and destroy sessionGET /auth/me- Get current user infoPOST /auth/logout-all- Logout from all devices
Installation
pip install ia-auth-sessions
For local development:
pip install -e ../ia_auth_sessions
Publishing
See PUBLISHING.md for instructions on publishing to PyPI.
To test the build locally:
python test_publish.py --skip-tests
Quick Start
from fastapi import FastAPI, Depends
from ia_auth_sessions import SessionMiddleware, get_current_user
from ia_auth_sessions.routes import router as auth_router
app = FastAPI()
# Add middleware and routes
app.add_middleware(SessionMiddleware, secret_key="your-secret-key", ...)
app.include_router(auth_router)
# Protected route
@app.get("/protected")
async def protected(user: dict = Depends(get_current_user)):
return {"message": f"Hello {user['username']}!"}
See USAGE.md for complete setup instructions.
Documentation
- USAGE.md - Complete setup guide, examples, and API reference
- ARCHITECTURE_NOTES.md - Design decisions and architecture
Database Schema
Automatically creates:
users: User accounts with bcrypt-hashed passwordssessions: Active sessions with metadata and expiry timestamps
License
MIT
Metadata
Release files for ia-auth-sessions 0.1.0
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 | |
|---|---|---|---|---|
| ia_auth_sessions-0.1.0.tar.gz | 17.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ia_auth_sessions-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / ia_auth_sessions-0.1.0.tar.gz
| Download URL | ia_auth_sessions-0.1.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5c2f1dbb909dc45b3416a69939b314fab503de28713f5918ce27469cd30abe2
|
|
BLAKE2b-256 checksum How to use checksums |
64bfa04f368e2adcac8849684e758b84f92df226cab9534288b21686c43a9b3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / ia_auth_sessions-0.1.0-py3-none-any.whl
| Download URL | ia_auth_sessions-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2600d734376a7508b29e4c257776c2762cc5b991a33adb78aa5fb429b3fec93b
|
|
BLAKE2b-256 checksum How to use checksums |
62b964307b7726f92b0581fff3fa808ba7d5029bfc39e718093c17738b83079b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for ia-auth-sessions 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.