按 DDD 重构认证流程并复用用户 bind 实现 LDAP 仓储

This commit is contained in:
2026-09-27 16:54:54 +00:00
parent 14f69a8a7c
commit a4b99d54f3
43 changed files with 1143 additions and 1167 deletions
+32
View File
@@ -0,0 +1,32 @@
export type CsrfToken = { name: string; value: string };
type PageBase = {
name: string;
error: string;
action: string;
csrf: CsrfToken;
};
export type SignInContext = PageBase & (
| { step: "password" }
| {
step: "mfa-pending";
identity: {
username: string;
subjectId: string;
email: string;
groups: string[];
groupDns: string[];
};
}
);
export function readPageContext(): SignInContext {
const data = document.getElementById("login-context")?.textContent;
if (!data) throw new Error("Missing login page context");
const context: SignInContext = JSON.parse(data);
if (context.step !== "password" && context.step !== "mfa-pending") {
throw new Error("Unknown login step");
}
return context;
}