Add token-based auth for WebDAV/NTLM and API access

- Add Token model with CRUD endpoints (/api/tokens, /auth/tokens)
- Support Basic auth with token:<secret> for built-in users
- Implement full NTLMv2 handshake for Windows WebDAV clients
- Add SSO token auth via check_permissions() proxy
- Hydrate request auth context from session or Authorization header
- Persist session cookie after successful Authorization-based login
- Add secure flag to session cookies based on request scheme
- Add frontend UserTokensModal for creating/revoking tokens
- Fix devserver to run workspace source via python -m cista
- Add tests for token CRUD and file auth (Basic, NTLM, session)
- Remove proactive WWW-Authenticate advertisement
This commit is contained in:
Leo Vasanko
2026-04-26 04:58:46 +00:00
parent d1faedc011
commit de78b41be4
17 changed files with 1779 additions and 60 deletions
+3 -2
View File
@@ -201,7 +201,7 @@ WS_CLOSE_CODES = {
}
def log_ws_close(ws_id: int, close_code: int | None, duration: float) -> None:
def log_ws_close(ws_id: int, close_code: int | None, duration: float, extra: str | None = None) -> None:
"""Log WebSocket connection close with duration and status."""
id_str = _format_ws_id(ws_id)
timing = format_duration_ms(duration * 1000)
@@ -216,8 +216,9 @@ def log_ws_close(ws_id: int, close_code: int | None, duration: float) -> None:
method_str = _format_method_label("closed", color=_TIMING)
status_str = f"{_WS_STATUS}{code} {status}{_RESET}"
timing_str = f"{_TIMING}{timing}{_RESET}"
extra_str = f" {_TIMING}{extra}{_RESET}" if extra else ""
logger.info("%s %s %s %s %s", " " * 19, id_str, method_str, status_str, timing_str)
logger.info("%s %s %s %s %s%s", " " * 19, id_str, method_str, status_str, timing_str, extra_str)
def configure_access_logging() -> None: