Forbes ab15582e26 Align client auth with backend: API tokens, session login, /api/auth/me
Rework the FreeCAD client authentication to match the Silo backend's
actual auth implementation (local, LDAP, OIDC/Keycloak, API tokens).

Auth model change:
- Remove the old AuthToken/AuthTokenExpiry session-token approach
- Unify on API tokens (ApiToken preference / SILO_API_TOKEN env var)
  as the single auth mechanism for the desktop client
- _get_auth_token() now delegates to _get_api_token() directly
- All requests use Bearer token auth via _get_auth_headers()

SiloClient.login() rewrite:
- POST form-encoded credentials to /login (matching the backend's
  form-based login handler, works with local and LDAP backends)
- Use the resulting session cookie to call GET /api/auth/me to get
  user info (username, role, auth_source)
- Create a persistent API token via POST /api/auth/tokens named
  'FreeCAD (hostname)' with 90-day expiry
- Store the raw token in ApiToken preference for all future requests
- No more ephemeral session tokens — API tokens survive restarts

New SiloClient methods:
- get_current_user(): GET /api/auth/me, returns user dict or None
- refresh_auth_info(): fetches /api/auth/me and updates cached prefs
- auth_role(): returns stored role (admin/editor/viewer)
- auth_source(): returns stored auth source (local/ldap/oidc)
- list_tokens(): GET /api/auth/tokens
- create_token(name, expires_in_days): POST /api/auth/tokens
- revoke_token(token_id): DELETE /api/auth/tokens/{id}

New preference keys:
- AuthRole: cached user role from server
- AuthSource: cached auth source (local, ldap, oidc)

Removed preference keys:
- AuthToken: replaced by ApiToken (was duplicative)
- AuthTokenExpiry: API tokens have server-side expiry

Auth helper changes:
- _save_auth_info(): stores username, role, source, and optionally token
- _clear_auth(): clears ApiToken, AuthUsername, AuthRole, AuthSource
- _get_auth_role(), _get_auth_source(): new accessors

Dock widget updates:
- New Role row showing role and auth source (e.g. 'editor (ldap)')
- Status refresh validates token against /api/auth/me on each poll
- Four status states: Connected (green), Token invalid (orange),
  Connected no auth (yellow), Disconnected (red)
- Caches validated user info back to preferences

Login dialog updates:
- Info text explains the flow (creates persistent API token)
- Placeholder text updated (removed LDAP-specific wording)
- Shows 'Logging in...' status during auth
- Displays role and auth source on success
- Disables login button during request

Settings dialog updates:
- API Token input field with show/hide toggle
- Token can be pasted directly from Silo web UI
- Hint text explains token sources (web UI, Login, env var)
- 'Clear Token and Logout' button replaces old clear credentials
- Save handler persists token changes
- Status summary shows role and auth source

check_connection() fix:
- Uses origin /health (not /api/health) matching actual route

Fixes the endpoint mismatch where client was calling a non-existent
POST /api/auth/login JSON endpoint. Now uses the actual form-based
POST /login + session cookie flow that the backend implements.
2026-01-31 16:24:07 -06:00
2026-01-29 13:10:12 -06:00
2026-01-29 13:10:12 -06:00
2026-01-29 13:10:12 -06:00
2026-01-29 13:10:12 -06:00
2026-01-29 13:10:12 -06:00

Kindred Silo

Item database and part management system for Kindred Create.

Overview

Kindred Silo is an R&D-oriented item database with:

  • Configurable part number generation via YAML schemas
  • FreeCAD integration with git-like commands (checkout, commit, status)
  • Revision tracking with append-only history
  • BOM management with reference designators and alternates
  • Physical inventory tracking with hierarchical locations

Components

silo/
├── cmd/
│   ├── silo/          # CLI tool
│   └── silod/         # API server
├── internal/
│   ├── api/           # HTTP handlers, routes, and templates
│   ├── config/        # Configuration loading
│   ├── db/            # PostgreSQL access
│   ├── migration/     # Property migration utilities
│   ├── partnum/       # Part number generation
│   ├── schema/        # YAML schema parsing
│   └── storage/       # MinIO file storage
├── pkg/
│   └── freecad/       # FreeCAD workbench (Python)
├── migrations/        # Database migration SQL scripts
├── schemas/           # Part numbering schema definitions (YAML)
├── deployments/       # Docker Compose and systemd configs
├── scripts/           # Deployment and setup scripts
└── docs/              # Documentation

Quick Start

# Database setup
psql -h psql.kindred.internal -U silo -d silo -f migrations/001_initial.sql

# Configure
cp config.example.yaml config.yaml
# Edit config.yaml with your settings

# Run server
go run ./cmd/silod

# CLI usage
go run ./cmd/silo register --schema kindred-rd --category F01

Configuration

See config.example.yaml for all options.

Kindred Create Integration

Install the workbench:

ln -s $(pwd)/pkg/freecad ~/.local/share/FreeCAD/Mod/KindredSilo

Then in Kindred Create, use the Silo workbench toolbar commands:

  • Pull - Download an item by part number
  • Commit - Save current state as a new revision with comment
  • Push - Batch upload modified files
  • Info - View revision history

License

MIT License - Copyright (c) 2026 Kindred Systems LLC

See LICENSE for details.

Description
No description provided
Readme MIT 3.6 MiB
Languages
Go 68.5%
TypeScript 25.5%
Shell 2.7%
PLpgSQL 2.4%
Makefile 0.5%
Other 0.3%