This commit is contained in:
Archer
2023-11-28 19:28:46 +08:00
committed by GitHub
parent e765c3bf95
commit a74e1d7166
75 changed files with 1139 additions and 417 deletions

View File

@@ -105,14 +105,13 @@ export async function parseHeaderCert({
};
}
// root user
async function parseRootKey(rootKey?: string, userId = '') {
async function parseRootKey(rootKey?: string) {
if (!rootKey || !process.env.ROOT_KEY || rootKey !== process.env.ROOT_KEY) {
return Promise.reject(ERROR_ENUM.unAuthorization);
}
return userId;
}
const { cookie, token, apikey, rootkey, userid, authorization } = (req.headers ||
const { cookie, token, apikey, rootkey, authorization } = (req.headers ||
{}) as ReqHeaderAuthType;
const { uid, teamId, tmbId, appId, openApiKey, authType } = await (async () => {
@@ -129,9 +128,10 @@ export async function parseHeaderCert({
};
}
if (authRoot && rootkey) {
await parseRootKey(rootkey);
// root user
return {
uid: await parseRootKey(rootkey, userid),
uid: '',
teamId: '',
tmbId: '',
appId: '',