Read this when changing browser-to-server API requests, sessions, CSRF, or JSON response behavior.
| File | Key symbols |
|---|---|
ui/app/src/api/client.js |
apiRequest, getSession, login, logout, navigation/notification functions |
src/OpenMind/Api/Api.php |
Versioned route registry |
src/OpenMind/Api/Controller.php |
JSON, request decoding, current user, CSRF, authorization helpers |
src/OpenMind/Api/AuthController.php |
Session inspection, login, logout |
src/OpenMind/Api/*Controller.php |
Navigation, configuration, user, and notification handlers |
getSession() through apiRequest().X-CSRF-Token.| Boundary | Mechanism | Location |
|---|---|---|
| Client-supplied URL path | API root is derived from same-origin Vite base; client uses fixed resource paths | ui/app/src/api/client.js |
| Credential input | Requires JSON object plus non-empty string username/password; verifies bcrypt hash server-side | AuthController::login() |
| Session fixation | Regenerates session ID after successful login | AuthController::login() |
| Cross-site state change | Session token compared with hash_equals before protected mutations |
Controller::validateCsrfToken() and mutation controllers |
| Authorization | Authentication and role checks run in PHP before data access | Controller::requireAuthentication() / requireRole() |
| Sensitive output | Controllers return explicit DTOs instead of mapper fields | Controller, UserController, NotificationController |
| Browser-only route control | React redirects unauthorized users, but does not grant access | ui/app/src/routes.jsx |
base is /phengine/assets/app/; the API client removes /assets/app to reach application root.fetch(..., { credentials: 'include' }).Cache-Control: no-store.NotificationMenu.See API routes and identity spec.