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.
The AuthResult
is of type ravyn.middleware.authentication.AuthResult
.
PARAMETER | DESCRIPTION |
---|---|
app
|
An ASGI type callable.
TYPE:
|
Source code in ravyn/middleware/authentication.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
authenticate
abstractmethod
async
¶
authenticate(request)
The abstract method that needs to be implemented for any authentication middleware.
Source code in ravyn/middleware/authentication.py
77 78 79 80 81 82 |
|