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.
Metadata
Release files for auth-toolkit-fastapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| auth_toolkit_fastapi-0.1.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auth_toolkit_fastapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / auth_toolkit_fastapi-0.1.0.tar.gz
| Download URL | auth_toolkit_fastapi-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de1a67db23977ceb6f08c44d92b781de99d0eac44699f3c0b3dd6ad18cf53515
|
|
BLAKE2b-256 checksum How to use checksums |
adc25c80ee792255b68167410b94bd246845cb856cf429eb0009022a72fd657a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / auth_toolkit_fastapi-0.1.0-py3-none-any.whl
| Download URL | auth_toolkit_fastapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f34a3d95906c6f312f78ec813dfae809b1fb46b1506f550ca3446b567191af2
|
|
BLAKE2b-256 checksum How to use checksums |
e2b218b505faa6ae2a7dcb56f2c373ae8c29ca526207eea40e926ab90aff5033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|