Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.3.3 instead.

blenx-auth

Reusable authentication library for FastAPI applications.

Status: Phase 1 — extracted from apps/api, not yet wired into the API. The existing API in apps/api continues to use its original auth code.

Features

  • JWT-based access and refresh token rotation
  • Email verification and password reset flows
  • Google OIDC OAuth client
  • Argon2id password hashing
  • Account lockout after repeated failures
  • Role / permission guards
  • Protocol-based repository contracts (SQLAlchemy backends included)
  • Framework-agnostic core (no FastAPI required to use services)

Installation

# Core — no web framework dependency
pip install blenx-auth

# With FastAPI integration layer
pip install blenx-auth[fastapi]

Structure

src/blenx_auth/
├── __init__.py
├── settings.py          # AuthSettings protocol (pure Python)
├── email.py             # EmailSender protocol + NullEmailSender
├── constants.py         # Security invariants
├── exceptions.py        # Domain exceptions
├── types.py             # Protocol contracts
├── password.py          # Argon2id hashing + policy
├── jwt.py               # TokenService
├── service.py           # Auth business logic
├── schemas.py           # Pydantic request/response models
├── google_oauth.py      # Google OIDC client (pure httpx-oauth)
├── db/
│   ├── __init__.py
│   ├── base.py          # AuthBase declarative base
│   └── session.py       # Async session factory helper
├── fastapi/             # FastAPI integration subpackage (optional)
│   ├── __init__.py
│   ├── dependencies.py  # get_settings, get_db_session, repo deps, current-user guards
│   ├── routes.py        # /auth and /users routers
│   ├── oauth.py         # Google OAuth authorize/callback routes
│   └── permissions.py   # require_admin / require_role dependency factories
├── models/
│   ├── __init__.py
│   ├── user.py
│   ├── oauth_account.py
│   └── refresh_token.py
└── repositories/
    ├── __init__.py
    ├── users.py
    ├── oauth_accounts.py
    └── refresh_tokens.py

Examples

See the examples/ directory for:

  • standalone.py — wiring core services to in-memory fakes (no DB, no web framework)
  • sqlalchemy_example.py — using the SQLAlchemy repositories

License

MIT

Metadata

Release files for blenx-auth 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blenx-auth 0.2.0
File Size Uploaded
blenx_auth-0.2.0.tar.gz 155.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blenx-auth 0.2.0
File Interpreter ABI Platform
blenx_auth-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 192.7 kB

Release files / blenx_auth-0.2.0.tar.gz

Download URL blenx_auth-0.2.0.tar.gz
Size 155.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3cae0d0d3be4372fe6c8769af1e3beab0b9e60e23c01f0833fa7659da336e63c
BLAKE2b-256 checksum
How to use checksums
0dc145f1442dd97993d6c202f666f19660237c2c4cc0db420618d9ef27884829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / blenx_auth-0.2.0-py3-none-any.whl

Download URL blenx_auth-0.2.0-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f41bced6fe13b3a1a25dc6b10adaa7dfce72db28b43fe5c0b1b3ba1864ac4b6
BLAKE2b-256 checksum
How to use checksums
2867dd1502b16c33810246ae39e86c2bed4273bdde2e99bd08016f0afb62fb05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

0.3.3

2 release files

0.3.2

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page