Metadata-Version: 2.5
Name: fastapi-auth-layer
Version: 0.1.0
Summary: Authentication & Authorization as a FastAPI dependency layer.
Author-email: Kevin Espejel <kevin.espejelmtz@gmail.com>
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.14
Requires-Dist: fastapi>=0.141.1
Requires-Dist: pydantic-settings>=2.15.0
Requires-Dist: pyjwt>=2.13.0
Requires-Dist: python-multipart>=0.0.32
Requires-Dist: uvicorn>=0.52.4
Description-Content-Type: text/markdown

# FastAPI Auth Kit

Authentication & Authorization as a FastAPI dependency layer. 
Stop rewriting JWT validation, user dependencies, and security exceptions in every project.

## 🚀 Features

* **FastAPI-Native:** Integrates seamlessly with `Depends()` and Swagger UI.
* **Database Agnostic:** Works with SQLAlchemy, MongoDB, Redis, or simple memory structures via Python Protocols.
* **Secure by Default:** Strict JWT algorithm enforcement, expiration handling, and standard HTTP security codes.

## 📦 Installation

```bash
pip install fastapi-auth-kit
# or using uv
uv add fastapi-auth-kit
```

## 🛠️ Quickstart

1. Define your UserProvider:

```python
from fastapi_auth_kit.protocols import AuthUser, UserProvider

class MyUserProvider(UserProvider):
    async def get_by_id(self, user_id: str) -> AuthUser | None:
        # Tu lógica de base de datos aquí (SQLAlchemy, Motor, etc.)
        return await db.users.find_one({"id": user_id})
```

2. Configure and secure your routes:

```python
from fastapi import FastAPI, Depends
from fastapi_auth_kit import Auth, AuthConfig

auth = Auth(
    config=AuthConfig(secret_key="your-super-secret-key"),
    user_provider=MyUserProvider()
)

app = FastAPI()

@app.get("/me")
async def get_profile(user = Depends(auth.current_user)):
    return {"id": user.id, "active": user.is_active}
```

## License Agreement
`fastapi-auth-kit` is open source and free to use. Can be used for commercial purposes for free, but please clearly display the copyright information about **FastAPI-Auth-Kit** in the display interface.

## Copyright
Copyright (c) 2026 Kevin Manuel Espejel Martinez. All rights reserved.
