Skip to main content

Authix - Authentication as a service

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

authix-0.0.5.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

authix-0.0.5-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file authix-0.0.5.tar.gz.

File metadata

  • Download URL: authix-0.0.5.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for authix-0.0.5.tar.gz
Algorithm Hash digest
SHA256 86194118f832a5e339370e56a566bf13ef75dd8d27206a1468530c3405d1ef29
MD5 4959b252a2d8148de7accca910751bd3
BLAKE2b-256 f586f1da7ba23294269c715b3619b08d9dddb0fc1cb8f9e8dbbcda10752fcc38

See more details on using hashes here.

File details

Details for the file authix-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: authix-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for authix-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eedc095cb2f66f24f9c1be1e66409374e5d19d0021ead00b67ad7928c21f6f0c
MD5 0aa07a965a0a3a85d4db4329322338ef
BLAKE2b-256 a912388245fedf89e8f64aed7f74f2f27101a8705418985a75b93b37051ef974

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page