Features

A complete map of what AllSafe Fast provides today, what's in progress, and what's planned. Every feature listed as Implemented is available in the current release. Features marked Planned are on the roadmap but not yet shipped.

Authentication Providers

AllSafe Fast ships five authentication providers. Each implements the AuthProvider protocol and can be enabled independently. You can also build your own — the provider interface is fully public.

ProviderDescriptionStatus
PasswordEmail + password sign-up and sign-in. Argon2id hashing, email verification, password reset.Implemented
OAuth 2.0Authorization Code flow with PKCE. Supports Google, GitHub, GitLab, and any OAuth 2.0 provider.Implemented
OIDCOpenID Connect with JWKS discovery and ID token verification. Supports any OIDC-compliant provider.Implemented
Magic LinkPasswordless sign-in via a one-time link sent to the user's email. 15-minute expiry, single use.Implemented
Email OTPPasswordless sign-in via a 6-digit one-time code sent to the user's email. 15-minute expiry, 3 attempts max.Implemented
Provider protocol

Every provider implements authenticate(context), get_identity(result), and contributes its own routes and Pydantic schemas. The ProviderRegistry manages registration and lookup by ID. Adding a provider never touches core logic.

Session Management

Sessions are the bridge between authentication (one-time proof of identity) and ongoing access (remembering the user across requests). AllSafe Fast uses a hybrid JWT + refresh token model.

FeatureDescriptionStatus
JWT Access TokensShort-lived (15 min) signed JWTs containing user ID, email, verification status, roles, and permissions. Verified in memory — no database query on every request.Implemented
Refresh Token RotationLong-lived (30 day) refresh tokens. Each use issues a new token and revokes the old one. Stored as SHA-256 hashes — the raw token is returned once and never persisted.Implemented
Theft DetectionIf a revoked refresh token is presented again, all of the user's sessions are immediately revoked and a TokenReuseError is raised.Implemented
Session RevocationRevoke a single session or all sessions for a user. Used by password reset, sign-out, and theft detection.Implemented
Session ListingList all active sessions for a user, including IP address and user agent from sign-in time.Implemented
Session Management UIA prebuilt dashboard for users to view and revoke their own sessions.Planned

Authorization

Authorization is enforced at the dependency level — the same dependency that authenticates also checks roles and permissions. Checks are stateless and in-memory because roles and permissions are embedded in the JWT.

FeatureDescriptionStatus
RolesAssign roles to users (e.g. admin, moderator). Require a single role with auth.user(role="admin") or any of several with auth.user(roles=["admin", "editor"]).Implemented
PermissionsAssign fine-grained permissions (e.g. reports:export, users:delete). Require one with auth.user(permission="...") or all of a set with auth.user(permissions=[...]).Implemented
Email Verification GateRequire a verified email with auth.user(verified=True). Useful for sensitive operations.Implemented
Route ProtectionOne dependency — auth.user() — handles authentication, verification, role checks, and permission checks. No separate middleware or decorators.Implemented
# Authorization is a keyword argument, not a separate system
@app.get("/admin")
async def admin(user=auth.user(role="admin")):
    ...

@app.delete("/users/{id}")
async def delete_user(id: str, user=auth.user(permission="users:delete")):
    ...

@app.post("/transfer")
async def transfer(user=auth.user(verified=True, permissions=["funds:send", "funds:receive"])):
    ...

Security

Security is not a feature you add later — it's the foundation. AllSafe Fast defaults to the safest option at every decision point and refuses to start in production with an insecure configuration.

FeatureDescriptionStatus
Argon2id Password HashingOWASP-recommended memory-hard algorithm. Auto-generated salts, configurable time/memory/parallelism parameters.Implemented
CSRF ProtectionCookie-based auth requires the X-AllSafe-CSRF header on every state-changing request. Bearer-token auth is immune by design.Implemented
Rate LimitingSliding-window rate limiter for auth endpoints. Redis backend for production, in-memory for development.Implemented
Enumeration PreventionLogin, sign-up, and password-reset return generic messages that don't reveal whether an email is registered.Implemented
Production GuardsRefuses to start in production with a default secret key, insecure cookies, or an insecure configuration.Implemented
Secure CookiesHttpOnly + Secure + SameSite=Lax by default. Configurable per environment.Implemented
Token HashingRefresh and verification tokens are SHA-256 hashed before storage. Raw tokens are returned once and never persisted.Implemented
Constant-Time ComparisonToken verification uses hmac.compare_digest to prevent timing attacks.Implemented

Extensibility

AllSafe Fast is designed to be extended, not forked. Hooks, plugins, custom providers, and protocol-based storage let you add behavior without modifying the framework.

FeatureDescriptionStatus
PluginsImplement the AllSafePlugin protocol to contribute routes, database tables, hooks, and schemas. Wired automatically by the PluginRegistry.Implemented
Hooks14 lifecycle events: user create, sign-in, session create/revoke, password reset, email verify, account link. Register via decorator, dict, or register_many.Implemented
Custom ProvidersImplement the AuthProvider protocol to add SAML, WebAuthn, or any custom authentication method.Implemented
Storage ProtocolsFour typing.Protocol interfaces. Implement your own adapter for MongoDB, DynamoDB, or any backend.Implemented
Custom Email ServiceSwap the default ConsoleEmailService for any implementation that sends transactional email.Implemented
🔌

14 Hook Events

Run custom logic on user creation, sign-in, session lifecycle, password reset, email verification, and account linking. Handlers fire synchronously in registration order and never break the auth flow.

🧩

Plugin System

Plugins contribute routes, tables, hooks, and schemas. The PluginContext gives them access to config, storage, JWT service, session manager, and the hook registry.

🔑

Custom Providers

The AuthProvider protocol is fully public. Implement authenticate() and get_identity(), contribute your routes and schemas, and register with the ProviderRegistry.

CLI Tools

The allsafe command-line interface scaffolds projects, generates secrets, manages migrations, and diagnoses configuration issues.

CommandDescriptionStatus
allsafe initScaffold a new project: create .env, generate a secret key, and create a starter configuration.Implemented
allsafe secretGenerate a cryptographically secure secret key for JWT signing.Implemented
allsafe db generateGenerate SQLAlchemy migration scripts from the AllSafe Fast schema.Implemented
allsafe db migrateApply pending migrations to the database.Implemented
allsafe doctorDiagnose your configuration and report security issues, missing dependencies, and environment problems.Implemented
Terminal
$ allsafe doctor AllSafe Fast Doctor v1.0.0 ────────────────────────────── ✓ Python 3.11.6 ✓ FastAPI 0.104.1 ✓ SQLAlchemy 2.0.23 (async) ✓ argon2-cffi 23.1.0 ✓ python-jose 3.3.0 ✓ ALLSAFE_SECRET_KEY: set (32 bytes) ✓ ALLSAFE_ENV: production ✓ Cookie config: HttpOnly, Secure, SameSite=Lax ────────────────────────────── All checks passed. Ready for production.

Storage

The core logic depends on storage protocols, not concrete implementations. Two backends ship; you can write your own.

BackendDescriptionStatus
In-MemoryDefault for development and testing. asyncio.Lock-guarded. Lost on restart.Implemented
Async SQLAlchemyProduction backend. PostgreSQL with native UUID and ARRAY types, async asyncpg driver, cascade deletes, indexed lookups.Implemented
RedisFor distributed rate limiting and session storage.Planned
MongoDBNoSQL adapter implementing the four storage protocols.Planned
💡
Protocol-based storage

The four storage protocols — UserStoreProtocol, AccountStoreProtocol, SessionStoreProtocol, VerificationStoreProtocol — are typing.Protocol interfaces. The StorageAdapter bundles all four. Swap in-memory for SQLAlchemy (or your own adapter) by changing one constructor argument. Core services never import SQLAlchemy.

Feature Summary

👤

5 Auth Providers

Password, OAuth 2.0, OIDC, Magic Link, Email OTP — all implemented and configurable.

🔒

JWT + Refresh

Access tokens in memory, refresh tokens in the database with rotation and theft detection.

🛡

8 Security Features

Argon2id, CSRF, rate limiting, enumeration prevention, production guards, secure cookies, token hashing, constant-time comparison.

📦

2 Storage Backends

In-memory for dev, async SQLAlchemy for production. Protocol-based for custom backends.

🔌

14 Hooks

Lifecycle events for user, session, password, email, and account operations.

💻

5 CLI Commands

init, secret, db generate, db migrate, doctor.