Skip to main content

Authix: Scalable Authentication Service

Welcome to Authix, an authentication service designed based on a talk by Brian Pontarelli.

Authix provides a comprehensive solution for user authentication, built on the principles of JWT (pronounced 'jot') and refresh tokens.

Key Features

  1. User Registration: Users can sign up using their email and password. Users are stored in MongoDB.

  2. User Login: Upon successful login, users receive:

    • A JWT access token in the Authorization header for immediate access.
    • A longer-lived refresh token as an HTTP cookie for extended sessions.
  3. Access Token Management: Generate new JWT access tokens using the provided refresh token, ensuring seamless user experiences.

  4. Public Key: Services can verify JWTs independently via public key, thereby reducing inter-service network calls.

  5. Secure Logout: Users are logged out by deleting their refresh token from storage, which thereby removes the possibility to create new access tokens. Furthermore, it informs all connected services via Kafka to reject JWTs from the logged-out user, that have been created prior to logging out.

  6. Token Lifespan:

    • JWT access tokens are valid for 5 minutes.
    • Refresh tokens, stored in REDIS, last for 4 weeks.

Diagrams

User Perspective

graph TB
  A["User"] -- "Register" --> B["/register"]
  A -- "Login" --> C["/login"]
  C -- "JWT & Refresh Token" --> A
  A -- "Use Refresh Token" --> D["/access_token"]
  D -- "New JWT" --> A
  A -- "Logout" --> E["/logout"]

Service Perspective

graph TB
  S["Service"] -- "Retrieve Public Key" --> PK["/public_key"]
  S -- "Verify JWT" --> V["Verify JWT using Public Key"]
  S -- "Handle Logout Broadcast" --> L["Reject soon-to-expire JWTs"]

Performance

On a single computer, running Authix via uvicorn with 16 workers, expect:

Create 1K users

1000 /register

2.97 seconds

Create 1K users, and login each user.

1000 /register
1000 /login

6.28 seconds

Create 10 users, for each user login, and call /access_token 1K times.

10 /register
10 /login
10000 /access_token

3.43 seconds

Metadata

Release files for authix 0.0.7

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

Source distribution (sdist)

Source distribution for authix 0.0.7
File Size Uploaded
authix-0.0.7.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for authix 0.0.7
File Interpreter ABI Platform
authix-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 39.6 kB

Release files / authix-0.0.7.tar.gz

Download URL authix-0.0.7.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7da57be9a99312ab7f79fa273c8740ab5bc2f5dad5a29cf0212fdbb0c4918c8d
BLAKE2b-256 checksum
How to use checksums
d2bf285973a2bfe1d20c3c55bf7570eb86c9f82fba3125ab26ad42cdcd997eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Release files / authix-0.0.7-py3-none-any.whl

Download URL authix-0.0.7-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0041c992068d19b747ac1f527b389c05b04d2cda180c29c7e933d85d73d06f71
BLAKE2b-256 checksum
How to use checksums
68f177a2175b03d1a0c5a0da5bec9152c359b2a98a837d80999ac33f68404afe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

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