greatmengqi
f942e4e597
feat(auth): wire auth end-to-end (middleware + frontend replacement)
Backend:
- Port auth_middleware, csrf_middleware, langgraph_auth, routers/auth
- Port authz decorator (owner_filter_key defaults to 'owner_id')
- Merge app.py: register AuthMiddleware + CSRFMiddleware + CORS, add
_ensure_admin_user lifespan hook, _migrate_orphaned_threads helper,
register auth router
- Merge deps.py: add get_local_provider, get_current_user_from_request,
get_optional_user_from_request; keep get_current_user as thin str|None
adapter for feedback router
- langgraph.json: add auth path pointing to langgraph_auth.py:auth
- Rename metadata['user_id'] -> metadata['owner_id'] in langgraph_auth
(both metadata write and LangGraph filter dict) + test fixtures
Frontend:
- Delete better-auth library and api catch-all route
- Remove better-auth npm dependency and env vars (BETTER_AUTH_SECRET,
BETTER_AUTH_GITHUB_*) from env.js
- Port frontend/src/core/auth/* (AuthProvider, gateway-config,
proxy-policy, server-side getServerSideUser, types)
- Port frontend/src/core/api/fetcher.ts
- Port (auth)/layout, (auth)/login, (auth)/setup pages
- Rewrite workspace/layout.tsx as server component that calls
getServerSideUser and wraps in AuthProvider
- Port workspace/workspace-content.tsx for the client-side sidebar logic
Tests:
- Port 5 auth test files (test_auth, test_auth_middleware,
test_auth_type_system, test_ensure_admin, test_langgraph_auth)
- 176 auth tests PASS
After this commit: login/logout/registration flow works, but persistence
layer does not yet filter by owner_id. Commit 4 closes that gap.
2026-04-08 09:41:56 +08:00
..
2026-03-14 22:55:52 +08:00
2026-03-27 20:03:30 +08:00
2026-04-01 11:42:12 +08:00
2026-03-31 22:19:27 +08:00
2026-04-02 15:39:41 +08:00
2026-03-22 20:34:01 +08:00
2026-03-26 17:44:25 +08:00
2026-04-08 09:21:36 +08:00
2026-04-08 09:21:36 +08:00
2026-04-08 09:41:56 +08:00
2026-04-08 09:41:56 +08:00
2026-04-08 09:41:56 +08:00
2026-04-07 11:53:52 +08:00
2026-04-07 11:53:52 +08:00
2026-04-07 11:53:52 +08:00
2026-03-22 17:29:29 +08:00
2026-03-30 07:41:18 +08:00
2026-03-26 14:20:18 +08:00
2026-03-29 21:03:58 +08:00
2026-03-29 21:03:58 +08:00
2026-04-06 10:09:39 +08:00
2026-03-14 22:55:52 +08:00
2026-04-07 11:53:52 +08:00
2026-03-29 15:31:18 +08:00
2026-04-06 16:47:19 +08:00
2026-03-22 22:39:50 +08:00
2026-04-05 10:49:58 +08:00
2026-03-26 00:20:08 +08:00
2026-03-31 22:19:27 +08:00
2026-04-08 09:41:56 +08:00
2026-04-07 11:53:52 +08:00
2026-04-07 11:53:52 +08:00
2026-04-04 14:25:08 +08:00
2026-04-01 23:21:32 +08:00
2026-03-23 18:07:33 +08:00
2026-03-14 22:55:52 +08:00
2026-03-26 14:20:18 +08:00
2026-04-03 15:28:56 +08:00
2026-04-01 17:02:39 +08:00
2026-04-08 09:41:56 +08:00
2026-04-07 11:53:52 +08:00
2026-03-31 22:22:30 +08:00
2026-04-07 11:53:52 +08:00
2026-04-02 10:12:17 +08:00
2026-03-29 21:03:58 +08:00
2026-03-29 21:31:29 +08:00
2026-04-03 19:46:22 +08:00
2026-04-04 10:38:22 +08:00
2026-03-14 22:55:52 +08:00
2026-03-14 22:55:52 +08:00
2026-03-26 14:20:18 +08:00
2026-04-03 11:21:58 +08:00
2026-04-05 16:23:00 +08:00
2026-04-01 16:45:29 +08:00
2026-03-29 15:34:38 +08:00
2026-04-05 16:23:00 +08:00
2026-04-05 16:23:00 +08:00
2026-03-22 20:39:26 +08:00
2026-04-07 11:53:52 +08:00
2026-03-20 17:18:59 +08:00
2026-03-26 15:07:05 +08:00
2026-04-07 11:53:52 +08:00
2026-03-14 22:55:52 +08:00
2026-02-25 08:39:29 +08:00
2026-03-14 22:55:52 +08:00
2026-03-14 22:55:52 +08:00
2026-04-07 11:53:52 +08:00
2026-04-07 11:53:52 +08:00
2026-03-31 22:22:30 +08:00
2026-04-07 11:53:52 +08:00
2026-04-06 17:21:58 +08:00
2026-04-03 16:03:06 +08:00
2026-04-05 15:52:22 +08:00
2026-04-07 11:53:52 +08:00
2026-03-30 16:02:23 +08:00
2026-03-26 14:20:18 +08:00
2026-04-07 11:53:52 +08:00
2026-03-25 16:28:33 +08:00
2026-04-07 11:53:52 +08:00
2026-03-26 17:39:16 +08:00
2026-04-07 11:53:52 +08:00
2026-04-01 23:08:30 +08:00
2026-03-27 20:20:31 +08:00
2026-03-30 16:02:23 +08:00
2026-04-06 14:51:10 +08:00
2026-03-14 22:55:52 +08:00
2026-03-25 10:20:16 +08:00
2026-03-29 21:03:58 +08:00
2026-04-05 15:41:00 +08:00
2026-04-04 21:19:35 +08:00
2026-03-29 21:03:58 +08:00
2026-03-26 17:39:16 +08:00
2026-04-07 11:53:52 +08:00
2026-03-24 00:36:08 +08:00
2026-03-14 22:55:52 +08:00
2026-04-04 21:19:35 +08:00
2026-03-26 00:20:50 +08:00
2026-03-26 14:20:18 +08:00
2026-03-14 22:55:52 +08:00
2026-04-06 15:09:57 +08:00
2026-03-30 11:23:15 +08:00
2026-04-02 13:06:10 +08:00
2026-04-02 13:06:10 +08:00
2026-03-26 17:39:16 +08:00
2026-04-04 14:25:08 +08:00
2026-03-27 17:37:44 +08:00
2026-04-06 15:18:34 +08:00