BaseAuthMiddleware class¶
This is the reference for the main object BaseAuthMiddleware that contains all the parameters,
attributes and functions.
ravyn.middleware.authentication.BaseAuthMiddleware
¶
BaseAuthMiddleware(app)
Bases: ABC, MiddlewareProtocol
BaseAuthMiddleware is the object that you can implement if you
want to implement any authentication middleware with Ravyn.
It is not mandatory to use it and you are free to implement your.
Ravyn being based on Lilya, also offers a simple but powerful
interface for handling authentication and permissions.
Once you have installed the AuthenticationMiddleware and implemented the
authenticate, the request.user will be available in any of your
endpoints.
Read more about how Ravyn implements the BaseAuthMiddleware.
When implementing the authenticate, you must assign the result into the
AuthResult object in order for the middleware to assign the request.user
properly.
Deprecation Warning
BaseAuthMiddleware is deprecated and will be removed in a future release.
Please use AuthenticationMiddleware from ravyn.middleware.authentication
which provides the same functionality with a more robust implementation.
The AuthResult is of type ravyn.middleware.authentication.AuthResult.
| PARAMETER | DESCRIPTION |
|---|---|
app
|
An ASGI type callable.
TYPE:
|
Source code in ravyn/middleware/authentication.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
authenticate
abstractmethod
async
¶
authenticate(request)
The abstract method that needs to be implemented for any authentication middleware.
Source code in ravyn/middleware/authentication.py
104 105 106 107 108 109 | |