Add permissions and audit logging to service tokens v3

This commit is contained in:
Tuan Dang
2023-09-25 13:24:28 +01:00
parent f59b3b3305
commit 698a268b5f
12 changed files with 246 additions and 58 deletions
+6 -2
View File
@@ -7,6 +7,7 @@ import { WorkspaceNotFoundError } from "../utils/errors";
import { AuthData } from "../interfaces/middleware";
import { z } from "zod";
import { EventType, UserAgentType } from "../ee/models";
import { UnauthorizedRequestError } from "../utils/errors";
/**
* Validate authenticated clients for workspace with id [workspaceId] based
@@ -56,8 +57,11 @@ export const validateClientForWorkspace = async ({
environment,
requiredPermissions
});
return {};
break;
case ActorType.SERVICE_V3:
throw UnauthorizedRequestError({
message: "Failed service token authorization for organization"
});
}
};