Hi I'm coming from FastAPI which has a dedicated API key backend. In my Litestar app I use a simple guard that looks like this:
async def api_key_guard(
connection: ASGIConnection,
_: BaseRouteHandler
) -> None:
api_key = connection.headers.get("X-API-Key")
if api_key != API_KEY:
raise NotAuthorizedException("Invalid API key")```
I like that this gets to the point with minimal boilerplate but the downside is that in the Swagger documentation, there is no authorization lock as in FastAPI.
If I use JWT security to implement this, will the Swagger docs lock down my routes? If so, what would be a straightforward way to translate my basic guard into one of Litestar's security backends?