mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 17:30:06 +00:00
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { WorkflowIntegrationsSchema } from "@app/db/schemas";
|
|
import { readLimit } from "@app/server/config/rateLimiter";
|
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|
import { AuthMode } from "@app/services/auth/auth-type";
|
|
|
|
const sanitizedWorkflowIntegrationSchema = WorkflowIntegrationsSchema.pick({
|
|
id: true,
|
|
description: true,
|
|
slug: true,
|
|
integration: true,
|
|
status: true
|
|
});
|
|
|
|
export const registerWorkflowIntegrationRouter = async (server: FastifyZodProvider) => {
|
|
server.route({
|
|
method: "GET",
|
|
url: "/",
|
|
config: {
|
|
rateLimit: readLimit
|
|
},
|
|
schema: {
|
|
security: [
|
|
{
|
|
bearerAuth: []
|
|
}
|
|
],
|
|
response: {
|
|
200: sanitizedWorkflowIntegrationSchema.array()
|
|
}
|
|
},
|
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
|
handler: async (req) => {
|
|
const workflowIntegrations = await server.services.workflowIntegration.getIntegrationsByOrg({
|
|
actor: req.permission.type,
|
|
actorId: req.permission.id,
|
|
actorAuthMethod: req.permission.authMethod,
|
|
actorOrgId: req.permission.orgId
|
|
});
|
|
|
|
return workflowIntegrations;
|
|
}
|
|
});
|
|
};
|