Migrate CollabTable's AuthGuard proxy onto shared/backend/auth
Replaces the ~1044-line bespoke session/login/TOTP/admin-user proxy
(backend/auth.go, built directly on authclient) with
sharedauth.NewWithStore, the same shared engine GameStream and
OmniLogger already migrated onto. A tiny collabTableAuthStore adapter
delegates the local one-time setup-claim flag to the existing
collabtable_setup_state table/queries; CollabTable never had a
"require login" toggle, so LoginRequired always reports true and
SetLoginRequired is a no-op.
The local authguard_totp_cache (GetCachedTOTPEnabled/
SetCachedTOTPEnabled) is retired: the shared engine reads TOTP status
live from AuthGuard's GET /api/me. Its table is left in place, same as
the already-dormant auth_users/auth_sessions tables.
URL paths and HTTP methods are unchanged; only response shapes
changed to the shared engine's standardized ones (nested `user: {...}`,
`data: {...}` for TOTP setup/enable/disable). Updated
frontend/src/lib/api.js to translate these back into the shapes the
rest of the frontend already expects, and AppShell.svelte's
saveProfile to always send the current username/email (UpdateMe
requires a non-empty email on every call).
Known behavior differences: POST /api/auth/setup now returns 201
instead of 200; PUT/PATCH /api/auth/users/{id} now returns the updated
user instead of {"ok":true}; POST /api/auth/credentials no longer
forces re-login after a successful change (no bulk session-invalidation
call exists in the shared engine, only single-session Logout).
The separate device/sync API bearer-token scheme (requireAPIToken,
handleTokenStatus/handleTokenRegenerate) is untouched other than
resolving the caller's identity via sharedauth.UserFromContext instead
of local session lookups.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aae8d3807d
commit
6e13364ebd
7 files changed
+300
-1230
No files matched your search
@@ -6,6 +6,6 @@ import (
|
||||
)
|
||||
|
||||
func TestRegisterRoutes(t *testing.T) {
|
||||
server := &Server{auth: &AuthService{}}
|
||||
server := &Server{auth: newAuthService(nil, "", false)}
|
||||
server.registerRoutes(http.NewServeMux(), webFS)
|
||||
}
|
||||
Reference in new issue
Block a user