feat(auth): session login with per-domain scope

Cookie session with /auth/login, /auth/logout and /auth/me. Four accounts come from WEBAPI_USUARIOS (admin plus one per domain) and a second before_request answers 403 when an account asks for another domain.

The data suites run with WEBAPI_AUTH_REQUIRED=0; test_auth.py turns the lock back on and covers both hooks. The Dockerfile normalises the entrypoint so a Windows checkout still starts the container.
This commit is contained in:
Erick ivan
2026-11-19 09:35:25 -06:00
parent b1bbbc25b4
commit 084fe2e8d3
6 changed files with 398 additions and 3 deletions
+5
View File
@@ -27,6 +27,11 @@ from webapi.orchestration.repositories import repositories_of
# Tests use throwaway SQLite files as "arbitrary SQL sources"; production
# excludes sqlite by default (see webapi.imports.connectors.sql_policy).
os.environ.setdefault("WEBAPI_SQL_ALLOWED_DIALECTS", "sqlite,mysql,mariadb,postgresql,mssql")
# The rest of the suite tests data and reports, not the login: with the lock
# on, every case would first have to authenticate. `test_auth.py` turns it
# back on for the cases that cover the lock itself.
os.environ.setdefault("WEBAPI_AUTH_REQUIRED", "0")
os.environ.setdefault("WEBAPI_SECRET_KEY", "clave-de-pruebas")
# The import log and the indicator queue write files; keep them out of the tree.
_STATE_DIR = tempfile.mkdtemp(prefix="webapi-tests-")
os.environ.setdefault("WEBAPI_REPORT_DIR", os.path.join(_STATE_DIR, "reportes"))