Read this when changing authentication, sessions, CSRF, roles, users, or user-management endpoints.
This subsystem authenticates database-backed users into PHP sessions and lets administrators manage accounts and roles without exposing credentials.
| Entity | Field | Type / storage | Notes |
|---|---|---|---|
users |
id |
auto-increment integer | Account identifier. |
users |
username |
varchar(255), unique |
Login identity and password-hash input. |
users |
saltedpassword |
varchar(255) |
Bcrypt hash of `username |
users |
roles |
varchar(4096) |
PHP-serialized role array; unserialized with classes disabled. |
| PHP session | SESSION.user |
integer | Current authenticated user ID. |
| PHP session | SESSION.csrf_token |
64-character hex string | Random 32-byte token used for state-changing API requests. |
| F3 global | USERROLES |
array of strings | Runtime role registry populated by plugins. |
username|password against the stored bcrypt hash.hash_equals; client route guards never replace this check.admin role cannot lose that role or be deleted.SELECT id FROM users FOR UPDATE; failures roll back the transaction.id, username, and, for administrator management, roles. Password hashes and serialized persistence fields never leave the API.| Constant | Value | Location |
|---|---|---|
User::PASSWORD_SEPARATOR |
` | ` |
Controller::CSRF_SESSION_KEY |
SESSION.csrf_token |
src/OpenMind/Api/Controller.php |
Controller::CSRF_HEADER |
HTTP_X_CSRF_TOKEN |
src/OpenMind/Api/Controller.php |
UserController::ADMIN_ROLE |
admin |
src/OpenMind/Api/UserController.php |
UserController::USERNAME_CONSTRAINT |
uq_users_username |
src/OpenMind/Api/UserController.php |
See API routes, MySQL integration, browser API integration, and the API endpoint rule.