๐ Features
- Add qualified router (10)
- Simpler jwt exp (12)
โ๏ธ Miscellaneous Tasks
- Pre-commit hooks fix (14)
- Bump to version 0.1.6b
---
Qualified Router (10)
A FastAPI APIRouter class, plus an extra rules parameter. It can be used to avoid multiple redundant rule declarations in same business area endpoints.
python
from fastapi import FastAPI
import missil
from missil.routers import QualifiedRouter
app = FastAPI()
ba = missil.make_rules(bearer, "sample") business area
sample_rule_router = missil.QualifiedRouter(rules=[ba["sample"].READ])
sample_rule_router .get("/sample/write")
def finances_write_route() -> dict[str, str]:
"""Requires read permission on finances."""
return {"msg": "finances write rights check via qualified router!"}
app.include_router(finances_read_router)
simpler JWT encode utility function (12)
python
token_expiration_in_hours = 8
token = missil.encode_jwt_token(claims, SECRET_KEY, token_expiration_in_hours)
**Full Changelog**: https://github.com/ericmiguel/missil/commits/v0.1.6b