Authentication
Base class for implementing the Authentication into SQLAdmin.
You need to inherit this class and override the methods:
login, logout and authenticate.
Source code in sqladmin/authentication.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
__init__(secret_key)
Source code in sqladmin/authentication.py
18 19 20 21 22 23 | |
authenticate(request)
async
Implement authenticate logic here. This method will be called for each incoming request to validate the authentication.
If a Response or RedirectResponse is returned,
that response is returned to the user,
otherwise a True/False is expected.
Source code in sqladmin/authentication.py
42 43 44 45 46 47 48 49 50 51 | |
login(request)
async
Implement login logic here.
You can access the login form data await request.form()
andvalidate the credentials.
Source code in sqladmin/authentication.py
25 26 27 28 29 30 | |
logout(request)
async
Implement logout logic here.
This will usually clear the session with request.session.clear().
If a Response or RedirectResponse is returned,
that response is returned to the user,
otherwise the user will be redirected to the index page.
Source code in sqladmin/authentication.py
32 33 34 35 36 37 38 39 40 | |