1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 03:36:48 +00:00
webvirtcloud/accounts/tests
catborise 1c60696ea1 feat(accounts): API tokens for scripts and tools
The REST API took only the login session, so a script could not use it
without a browser. A user now makes API tokens on the profile page (API
Tokens tab): a name, and an expiry of 30, 90 or 365 days or none. The
token is shown once, on a page that is not cached, and then kept only as
a SHA-512 digest; the list shows its name, first characters, creation
and expiry, and a token is deleted there. Tools send it as
"Authorization: Token wvc_...", and act as its user, with that user's
permissions. Making and deleting a token is logged, without the token.

A password alone (HTTP Basic) still does not reach the API, as it would
skip the OTP second factor: a token is made in a session that passed the
login and its OTP. The token class comes first, so a refused request gets
401 with its challenge instead of 403.

django-rest-knox 5.1.0 provides the tokens (accounts.ApiToken adds the
name); settings.py takes "knox", KNOX_TOKEN_MODEL and REST_KNOX from the
template.
2026-10-24 23:14:27 +03:00
..
__init__.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_admin_email_otp.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_admin_password.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_api_tokens.py feat(accounts): API tokens for scripts and tools 2026-10-24 23:14:27 +03:00
test_audit_rows.py feat(logs): every VM operation writes an audit row the VM's Logs tab finds by UUID 2026-10-24 14:14:53 +03:00
test_change_password_permission.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_checks.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_email_otp.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_first_login_password.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_login_lockout.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_otp_login.py fix(accounts): a username longer than the field is refused by the login form 2026-10-23 16:06:10 +03:00
test_security_fixes.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_utils.py test: each app keeps its tests in a tests package 2026-10-12 15:17:30 +03:00
test_views.py fix(accounts): a VM's only owner can be edited when one owner is allowed 2026-10-23 13:30:25 +03:00