feat(auth): 接入 Casdoor 登录并让前端持有本服务会话

管理台可以密码登录、按角色进入,并把 Watchman 会话 token 交给浏览器。HXOPS 真实跳转仍未联调。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
unknownandCursor committed 2026-11-17 18:39:56 +08:00
1 parent 21338337a1
commit ab31d828d4
64 files changed
+4140 -339

No files matched your search

+17
View File
@@ -7,8 +7,23 @@ const evidenceDir = path.resolve(
"../../../../docs/evidence/M01/ui",
);
async function signedInAdmin(page: import("@playwright/test").Page) {
await page.route("**/auth/me", async (route) => {
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
success: true,
data: { subject: "admin-1", display_name: "Admin", roles: ["watchman-admin"] },
request_id: "pw-me",
}),
});
});
}
test.describe("health three states", () => {
test("loading then success", async ({ page }) => {
await signedInAdmin(page);
await page.route("**/health", async (route) => {
await new Promise((resolve) => setTimeout(resolve, 800));
await route.fulfill({
@@ -38,6 +53,7 @@ test.describe("health three states", () => {
});
test("failure state", async ({ page }) => {
await signedInAdmin(page);
await page.route("**/health", async (route) => {
await route.fulfill({
status: 500,
@@ -66,6 +82,7 @@ test.describe("health three states", () => {
});
test("english locale via query override is readable", async ({ page }) => {
await signedInAdmin(page);
await page.addInitScript(() => {
window.localStorage.setItem("watchman.lang", "en");
});