media-backend/media-webui: proxy admin login identity to AuthGuard

The media-collection family (KioskDisplay, MediaAnalyzer, MediaTools,
MediaViewer, MediaServant, ModerationHub, ProjectConfigurator) shared one
standalone local single-admin auth implementation with no AuthGuard
connection, including its own local "reset admin account" flow - the same
situation the recently-migrated forks were in. Proxies every /auth/... and
/api/auth/... admin-identity operation to AuthGuard via the existing Go
authclient, forwards its Set-Cookie, keeps a local one-time setup-claim flag
(reusing the existing settings table, no schema change), and drops the local
reset flow entirely (only AuthGuard's own web UI keeps one now).

Deliberately left untouched: the separate "moderator manages platform
users" surface (admin_storage.go's mountModeratorRoutes) and the
independent loginRequired/auth_required public-install toggle, both of
which are unrelated to this service's own admin login identity despite
superficially sharing code style/table with the migrated pieces.
This commit is contained in:
Gabriel20xx committed 2026-09-02 21:45:19 +02:00
1 parent de9b599232
commit 9589d07baf
7 files changed
+1055 -560

No files matched your search

+1 -3
View File
@@ -138,7 +138,7 @@ func New(cfg *config.Config, db *pgxpool.Pool) *Server {
return &Server{
cfg: cfg,
db: db,
auth: auth.New(db, cfg.SessionCookie, cfg.SecureCookies),
auth: auth.New(db, cfg.SessionCookie, cfg.SecureCookies, cfg.AuthGuardURL),
startedAt: time.Now(),
media: make(map[string]MediaRecord),
jobs: make(map[string]*WorkflowJob),
@@ -167,8 +167,6 @@ func (s *Server) Handler() http.Handler {
r.Post("/signup", s.auth.Signup)
r.Post("/login", s.auth.Login)
r.Post("/logout", s.auth.Logout)
r.Post("/reset/request", s.auth.RequestAdminReset)
r.Post("/reset/confirm", s.auth.ConfirmAdminReset)
r.Get("/me", s.auth.Me)
r.With(s.auth.Require).Put("/me", s.auth.UpdateMe)
r.Get("/status", s.auth.Status)