Metadata-Version: 2.4
Name: fastapi-login-shield
Version: 0.1.2
Summary: Protect FastAPI login endpoints from brute-force attacks
Project-URL: Homepage, https://github.com/MrMrProgrammer/fastapi-login-shield
Project-URL: Repository, https://github.com/MrMrProgrammer/fastapi-login-shield
Author-email: MrMrProgrammer <mrmrprogrammer@gmail.com>
License: MIT
Requires-Python: >=3.7
Requires-Dist: fastapi>=0.95.0
Requires-Dist: starlette>=0.27.0
Description-Content-Type: text/markdown

# fastapi-login-shield

A minimal FastAPI middleware to prevent brute-force login attempts based on client IP.

## Features

- IP-based login rate limiting
- Exponential backoff delays
- Lightweight, no Redis required

## Usage

```python
from fastapi import FastAPI, Request
from fastapi_login_shield import LoginShieldMiddleware, register_login_result

app = FastAPI()
app.add_middleware(LoginShieldMiddleware, login_path="/login")

@app.post("/login")
async def login(request: Request):
    ip = request.headers.get("X-Forwarded-For", request.client.host)
    ...
    await register_login_result(ip, success=True|False)
```
