An open API service indexing awesome lists of open source software.

https://github.com/iudeen/asgijwtsignaturevalidatormiddleware


https://github.com/iudeen/asgijwtsignaturevalidatormiddleware

fastapi hacktoberfest hacktoberfest2022 jwt middleware

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          


JWT Signature Validator




Latest Commit






Package version



JWT Signature Middleware is a pure ASGI Middleware that can be used with AGSI frameworks like FastAPI, Starlette and Sanic.

## Installation

```bash
pip install jwt-signature-validator
```

## Usage

```python
from fastapi import FastAPI
from jwt_signature_validator import EncodedPayloadSignatureMiddleware
from pydantic import BaseModel

app = FastAPI()

app.add_middleware(
EncodedPayloadSignatureMiddleware,
jwt_secret="hello",
jwt_algorithms=["HS256"],
protect_hosts=["*"]
)

class Model(BaseModel):
text: str

@app.post("/")
def check(req: Model):
return req

```

## License

This project is licensed under the terms of the MIT license.