Commit Graph
5 Commits
Author SHA1 Message Date
Gabriel20xxandClaude Sonnet 5 663d498a03 Add per-user project-access restriction; generalize mediaauth into a unified auth proxy
shared/backend/auth: adds SchemaOptions.ProjectScoping and Store methods
(SetUserProjects/UserProjects/UserProjectsByUser/IsProjectAllowed,
SetKnownProjects/KnownProjects) backing AuthGuard's new per-user
project-access restriction.

shared/backend/authclient: Client can now identify its calling project to
AuthServer via WithProjectKey (sent as X-Project-Key on every request), so
AuthServer can enforce the restriction above per project.

shared/backend/mediaauth: generalized from a media-family-only package
into the one shared auth-proxy engine every AuthGuard-integrated project
should use. New accepts a projectKey; the login-required/setup-claim
storage it needs is now expressed as a small Store interface
(NewWithStore lets any project's own storage satisfy it, not just the
media family's shared `settings` table, which pgSettingsStore still backs
for existing callers). ManagedUpdateUser/ManagedDeleteUser now resolve
their {id} path param via chi.URLParam OR the stdlib 1.22+ ServeMux's
PathValue, so non-chi consumers work unchanged.

packages/web-ui: UserManagement gains an optional `projects` prop (a
per-account project-access picker), used only by AuthGuard's own admin UI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 12:16:17 +02:00
Gabriel20xxandClaude Sonnet 5 ee59571552 Rename ProjectConfigurator, restructure Projects workspace, retire MediaCollection naming
- Rename MediaConfig -> ProjectConfigurator throughout; drop the Parameters
  tab/page; rename the Mounts tab to Projects and restructure it into three
  sections: Central services, Main services, Third-party services
- Add a self-describe contract (GET /api/info returning name/tabs/mountTypes)
  and a server-side discovery proxy (POST /api/discover-service) so adding a
  main service only requires a URL
- Add ProjectConfigurator HA: multiple instances now sync their settings with
  each other (GET /api/settings/export, POST /api/settings/sync, a periodic
  background puller), last-write-wins per key by updated_at
- Add a generic, project-agnostic file-storage API on CarrierNode
  (GET/POST/DELETE /api/mount/{project}/{type}[/*]) driven by the same
  configured_mounts data the Projects workspace already writes, usable by any
  registered project, not just the media family
- Add last_login_at tracking to the shared auth Store/User (schema, queries,
  UpdateLastLogin) and surface it through the shared web-ui ManagedUser type
  and UserManagement component
- Retire the "MediaCollection" name: Go module -> repos.gfranz.ch/Gabriel20xx/shared/media-backend,
  binary -> mediabackend, session cookie default -> "session", media-webui
  merged into webui, media-shared-assets renamed to legacy-assets and pruned
  to the one file MediaDesktop still uses

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:02:16 +02:00
Gabriel20xxandClaude Sonnet 5 db733a6bf4 Fix critical login/session bug: Store.find() Scan missing Role column
Store.find() (backing FindByIdentifier - used by login - FindByID, and
FindSessionUser, used on every authenticated request) selected 7 columns
but only Scan()'d 6 destinations, missing &user.Role entirely:

  find user: find auth user: number of field descriptions must equal
  number of destinations, got 7 and 6

This broke essentially all login and session validation, in every project
vendoring this package, against a real Postgres database. It went
undetected because the existing test suite uses a hand-written fake store
in each consumer's own httpapi package that never exercises the real
query/Scan pair - only a real driver round-trip surfaces a
destination-count mismatch like this.

Adds backend/auth/store_integration_test.go (skipped unless DATABASE_URL
is set, so it never runs in default CI) covering create, find-by-identifier,
find-by-id, find-by-session, and list-users against a real database, to
catch this class of regression going forward. Verified against a real
Postgres container: reproduced the exact reported error before the fix,
passes after.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-01 21:51:15 +02:00
Gabriel20xx da97fd4fb1 feat(auth): implement TOTP setup and management
Lint / Lint (Node/Svelte) (push) Successful in 24s
Lint / Lint (Go) (push) Successful in 28s
Lint / Lint (Python) (push) Failing after 14s
Tests / Test (Node/Svelte) (push) Successful in 18s
Tests / Test (Go) (push) Successful in 25s
Tests / Test (Python) (push) Successful in 12s
- Added TOTP support for two-factor authentication in the auth module.
- Introduced new types and interfaces for TOTP setup and token actions in the web UI.
- Created backend logic for generating and verifying TOTP secrets and tokens.
- Implemented user management features including role assignments and user CRUD operations.
- Enhanced UI components for managing users and TOTP settings.
- Added styles for optional labels and authentication reset links.
- Implemented reset code generation and validation for admin accounts.
2026-08-05 14:57:01 +02:00
Gabriel20xx 838a97d344 Add initial shared code packages 2026-08-04 15:17:15 +02:00