This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
Right way to add authentification middleware #692
Labels
enhancement
New feature or request
feedback
User's feedback
plugins
Plugins and extensions for MLEM!
serve
Serving models
Other question:
If I'm understanding correctly, the middleware
on_request
methods are called after the request_serializer. Is there a way to add layers before therequest_serializer
.I was trying to add authentification middleware (for FastApi). I first tried to inherit from
FastAPIMiddleware
, and do a test in theon_request
method (to test if the fieldapi_key
of the request header has the correct value). The problem is, since I am using thepil_numpy
serializer, therequest
argument ofon_request
is a Numpy array.So the only solution I have found is:
Is there a better way to do it?
reported in discord
The text was updated successfully, but these errors were encountered: