LiveOpen SourceAuthPython

b3dmar-auth-core

Authentication primitives for FastAPI services

A shared library for JWT handling, password hashing, RBAC, and token revocation - extracted from production services and designed to drop into any FastAPI project.

1 min read

Why this exists

Every FastAPI service needs authentication, and the patterns are always the same: validate JWTs, hash passwords, check permissions, handle token revocation. Rather than copying this logic across 3ngram, Climbr, and future services, we extracted the common patterns into a tested, documented library.

What it provides

JWT module - token creation and validation with type discrimination (access vs. refresh), JTI tracking, and configurable issuer/audience claims.

Password module - Argon2id hashing following OWASP recommendations. Drop-in replacement for bcrypt with better resistance to GPU and side-channel attacks.

RBAC module - generic permission checker with FastAPI dependency factories. You define the permission matrix; the library handles enforcement.

Revocation module - Redis-backed token denylist with configurable fail-open (allow if Redis is down) or fail-closed (deny if Redis is down) modes, depending on your security requirements.

Rate limiting - pre-configured slowapi limiter for auth endpoints to prevent brute-force attacks.

Schemas - Pydantic v2 models for token payloads and auth responses.

Design principles

Stateless and composable. Each module works independently. Use all of them or just the JWT validation.

Domain-agnostic. No opinion on your user model, database, or tenancy scheme. You bring your own user lookup - the library handles the auth mechanics.

Production-tested. Every primitive runs in production across multiple services before being extracted here.

Getting started

pip install git+https://github.com/sebastianebg/b3dmar-auth-core.git

See the repository README and cookbook/ directory for integration examples covering common patterns: basic JWT auth, multi-tenant RBAC, refresh token rotation, and revocation setup.

  • LiveOpen SourceGTM

    GTM:OS

    Open-source GTM workflow toolkit for AI assistants

    8 skills and 3 agents that turn a markdown pipeline file into a daily operating system - morning briefs, lead qualification, prospect research, and personalized outreach. No CRM required.

    PythonClaude Code SkillsCodexClaude Cowork
  • LiveDeveloper ToolsAI

    sp3cmar

    Structured development framework for AI coding agents

    A skill library and review framework that brings discipline to AI-assisted development - specs before code, reviews before merge, accountability throughout.

    PythonClaude Code SkillsGitHub Actions
  • LiveAIMCP

    3ngram

    Your AI Chief of Staff

    Persistent memory for AI assistants. 3ngram remembers your decisions, tracks your commitments, and briefs your AI on what happened last session - so you never start from zero.

    PythonFastAPIPostgreSQLpgvector+4

Want this kind of engineering on your team?

The same practices behind these products are available as consulting. Tell us what you are building and we will tell you honestly whether we can help.