Flexible authentication fastapi toolkit with websocet if u need
Project description
Auth Toolkit
Flexible authentication module for Python applications.
Гибкий модуль аутентификации для Python приложений.
Installation / Установка
pip install auth-toolkit-fastapi
For WebSocket support / С поддержкой WebSocket:
pip install auth-toolkit-fastapi[websocket]
Quick Start / Быстрый старт
from auth_toolkit_fastapi import Auth, DefaultMethods
# Create your own methods class
# Создайте собственный класс методов
class MyMethods(DefaultMethods):
@staticmethod
def get_user(username: str):
# Your user retrieval logic
# Ваша логика получения пользователя
return user_object
# Initialize
# Инициализация
auth = Auth(
methods=MyMethods(),
secret_key="your-secret-key",
access_token_expire_minutes=60
)
# Login
# Логин
result = auth.login({"email": "user@example.com", "password": "password"})
# Returns: {"access_token": "...", "token_type": "bearer"}
# Get user from token
# Получение пользователя из токена
user_id = auth.get_user_from_token(token)
Features / Возможности
- 🔐 JWT token authentication
- 🔑 Flexible password hashing with pwdlib
- 🔌 Plugin system (WebSocket support included)
- ⚙️ Configurable authentication methods
- 🎯 Easy to extend and customize
Project Structure / Структура проекта
core/- Core authentication classesexceptions/- Custom exceptionsplugins/- Plugins (e.g., WebSocket)
Requirements / Требования
- Python >= 3.8
- jwt >= 2.0.0
- pwdlib >= 1.0.0
- fastapi >= 0.100.0 (optional, for WebSocket plugin)
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auth_toolkit_fastapi-0.1.0.tar.gz.
File metadata
- Download URL: auth_toolkit_fastapi-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de1a67db23977ceb6f08c44d92b781de99d0eac44699f3c0b3dd6ad18cf53515
|
|
| MD5 |
8c5d64b359286d781ddb3dc1bd8a1818
|
|
| BLAKE2b-256 |
adc25c80ee792255b68167410b94bd246845cb856cf429eb0009022a72fd657a
|
File details
Details for the file auth_toolkit_fastapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: auth_toolkit_fastapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f34a3d95906c6f312f78ec813dfae809b1fb46b1506f550ca3446b567191af2
|
|
| MD5 |
95ca311aadab166ed11fb4adccd1d1cd
|
|
| BLAKE2b-256 |
e2b218b505faa6ae2a7dcb56f2c373ae8c29ca526207eea40e926ab90aff5033
|