feat: add seal auth providers

This commit is contained in:
gitea committed 2026-06-05 16:04:09 +08:00
1 parent 25e4dd7714
commit d575683c8b
8 files changed
+510

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { CorpConfig } from "../config/types.js";
import { SealSession } from "./types.js";
export async function getDirectSealSession(corp: CorpConfig): Promise<SealSession> {
if (corp.source.type !== "direct") {
throw new Error(`Unsupported Seal source: ${corp.source.type}`);
}
const sealUrl = corp.seal.url ?? corp.source.sealUrl;
return {
token: corp.source.token,
expiresAt: Date.now() + corp.source.expiresIn * 1000,
enterprise: {
provider: "direct",
corpId: corp.source.corpId ?? corp.id,
staffId: corp.source.staffId,
sealUrl,
tenantSlug: corp.seal.tenantSlug,
raw: {
sourceType: "direct"
}
}
};
}