Same pattern as GameStream (commit 6a46007), adapted for CollabTable being genuinely multi-user (not single-admin): admin user management (list/create/update/delete, role reassignment, superadmin protection) is fully proxied to AuthGuard, which already enforces the same rules CollabTable checked locally. Cookie forwarding, no local session token, AUTHGUARD_URL optional (unset = auth fully disabled), transport failures always surface as errAuthGuardUnavailable rather than ever letting a request through - proven with live tests against a closed socket. CollabTable's device-sync API token feature (separate from browser sessions) is deliberately left local-only regardless of AUTHGUARD_URL, keyed by a new currentUserID helper (AuthGuard's id when enabled, the shared placeholder id 0 when disabled) - a real, functional token either way, not faked data. Real bug found and fixed: api_tokens.user_id had a hard FK into the local auth_users table, which would reject new tokens once accounts stop being written locally. Dropped the now-invalid FK. Known, accepted gap (same as GameStream): self-service profile editing for non-admin accounts is lost, since AuthGuard only exposes an admin endpoint, no self-edit. TOTP QR issuer branding now comes from AuthGuard rather than CollabTable. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
20 lines
1.4 KiB
Markdown
20 lines
1.4 KiB
Markdown
# Shared Go backend packages
|
|
|
|
The Go packages under this directory hold infrastructure shared by the
|
|
services, not application-specific SQL or HTTP handlers.
|
|
|
|
- `config` — environment string, required value, boolean, integer, and duration helpers.
|
|
- `postgres` — validated `DATABASE_URL` configuration, `pgxpool` creation/ping, transaction wrapper, and PostgreSQL error classification.
|
|
- `auth` — shared bcrypt policy, secure token generation/hashing, account/session schema, and account/session persistence.
|
|
- `authclient` — HTTP client and `net/http` middleware for services that adopt the centralized AuthServer instead of embedding `auth` against their own database.
|
|
- `migrate` — embedded filesystem adapter for Goose migrations.
|
|
- `logshipper` — client adapter for LoggingServer (Web/LoggingServer): batches and ships log entries centrally while mirroring the same human-readable output and Debug/Info/Warn/Error/Critical/Audit/*Ctx method surface as each project's local internal/logging package.
|
|
|
|
Run `go test ./...` and `go vet ./...` from this directory. The module path is
|
|
`repos.gfranz.ch/Gabriel20xx/shared/backend`; change it if the shared folder is
|
|
hosted under a different repository path.
|
|
|
|
Application-specific table definitions and HTTP behavior stay in the service.
|
|
That lets a service reuse reliable connection/auth plumbing without coupling
|
|
its domain model to another project.
|