prefect.server.api.middleware

Classes

CsrfMiddleware

Middleware for CSRF protection. This middleware will check for a CSRF token in the headers of any POST, PUT, PATCH, or DELETE request. If the token is not present or does not match the token stored in the database for the client, the request will be rejected with a 403 status code. Methods:

dispatch

dispatch(self, request: Request, call_next: NextMiddlewareFunction) -> Response
Dispatch method for the middleware. This method will check for the presence of a CSRF token in the headers of the request and compare it to the token stored in the database for the client. If the token is not present or does not match, the request will be rejected with a 403 status code.