[FastAPI] User authentication and user-based routes
Dependency Additions
-
python-bcrypt- Required for password hashing compatible with aurweb
-
python-email-validator- Required for email validation from form input
-
python-lxml- Used for some testing of HTML content
-
python-pytz- Used for timezone management
Test-only Dependencies
-
openssh- We use executables in here for key generation during SSHPubKey tests
Additions
- Added
aurweb.db.query- An ORM helper function which performs a query and returns the result
- Added
aurweb.db.create- An ORM helper function which creates a record and returns the row
- Added
aurweb.db.delete- An ORM helper function which deletes a record
- Added
aurweb.auth.AnonymousUser-
request.user's class when the request is not authenticated
-
- Added
aurweb.auth.BasicAuthBackend- A starlette Authentication middleware backend for aurweb
- Added
aurweb.auth.auth_required(is_required = True, redirect = "/", template = None)- A route decorator:
@auth_required(redirect="/blah", template="blah.html")
- A route decorator:
- Added
aurweb.auth.user_developer_or_trusted_user(user) - Added
aurweb.auth.trusted_user(user) - Added
aurweb.auth.developer(user) - Added
aurweb.auth.trusted_user_or_dev(user) - Added credential constants prefixed with
CRED_inaurweb.auth. - Added
aurweb.auth.has_credential(user, credential, approved_users = tuple())- Check to see if
userhascredential, who are automatically approved if they exist inapproved_users.
- Check to see if
- Added
aurweb.templates.is_list- A new filter automatically passed to the Jinja environment
- Added
aurweb.templates.is_str- A new filter automatically passed to the Jinja environment
- Added
BanSQLAlchemy ORM model - Added
SessionSQLAlchemy ORM model - Added
SSHPubKeySQLAlchemy ORM model - Added
User.authenticate - Added
User.is_authenticated - Added
User.login - Added
User.logout - Added
Usercredentials, cloning the PHP implementation's method- Supports
Users,Trusted Users,Developers,Trusted Users & Developers
- Supports
- Added
aurweb.captcha, a module containing captcha utilities - Added
aurweb.time, a module with time-wise helper functions - Added
/passresetget and post routes - Added
/registerget and post routes - Added
/loginget and post routes - Added
/logoutget and post routes - Added
/account/<username>get route - Added
/account/<username>/editget and post route
Modifications
- Take
request.user.LangPreferenceinto account when authenticated - We now use the
request.user's timezone when authenticated - User now has an internal
sessionrelationship
NOTE: This list will be updated as the branch is prepared for review, it is still a work in progress.
Edited by Kevin Morris