Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

style: fix prettier formatting in identity auth routers

Devin AIfbc6785f59b7
diff --git a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
index 598a7bf8d4..79e6687b9a 100644
--- a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
@@ -9,10 +9,10 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateArns } from "@app/services/identity-alicloud-auth/identity-alicloud-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -94,16 +94,18 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityAliCloudAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityAliCloudAuth.identityId,
- orgId: identity.orgId,
- authMethod: "alicloud"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAliCloudAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "alicloud"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -203,16 +205,18 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAliCloudAuth.orgId,
- properties: {
- identityId: identityAliCloudAuth.identityId,
- orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ })
+ .catch(() => {});
return { identityAliCloudAuth };
}
@@ -307,16 +311,18 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAliCloudAuth.orgId,
- properties: {
- identityId: identityAliCloudAuth.identityId,
- orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ })
+ .catch(() => {});
return { identityAliCloudAuth };
}
@@ -417,16 +423,18 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAliCloudAuth.orgId,
- properties: {
- identityId: identityAliCloudAuth.identityId,
- orgId: identityAliCloudAuth.orgId,
- authMethod: "alicloud"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAliCloudAuth.orgId,
+ properties: {
+ identityId: identityAliCloudAuth.identityId,
+ orgId: identityAliCloudAuth.orgId,
+ authMethod: "alicloud"
+ }
+ })
+ .catch(() => {});
return { identityAliCloudAuth };
}
diff --git a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
index fbecdcc034..9c0b24a6b1 100644
--- a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
@@ -61,16 +61,18 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityAwsAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityAwsAuth.identityId,
- orgId: identity.orgId,
- authMethod: "aws_iam"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAwsAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "aws_iam"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -174,16 +176,18 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAwsAuth.orgId,
- properties: {
- identityId: identityAwsAuth.identityId,
- orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ })
+ .catch(() => {});
return { identityAwsAuth };
}
@@ -270,16 +274,18 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAwsAuth.orgId,
- properties: {
- identityId: identityAwsAuth.identityId,
- orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ })
+ .catch(() => {});
return { identityAwsAuth };
}
@@ -380,16 +386,18 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAwsAuth.orgId,
- properties: {
- identityId: identityAwsAuth.identityId,
- orgId: identityAwsAuth.orgId,
- authMethod: "aws_iam"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAwsAuth.orgId,
+ properties: {
+ identityId: identityAwsAuth.identityId,
+ orgId: identityAwsAuth.orgId,
+ authMethod: "aws_iam"
+ }
+ })
+ .catch(() => {});
return { identityAwsAuth };
}
diff --git a/backend/src/server/routes/v1/identity-azure-auth-router.ts b/backend/src/server/routes/v1/identity-azure-auth-router.ts
index 1a057090f1..5f22fa8dd4 100644
--- a/backend/src/server/routes/v1/identity-azure-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-azure-auth-router.ts
@@ -56,16 +56,18 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityAzureAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityAzureAuth.identityId,
- orgId: identity.orgId,
- authMethod: "azure"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityAzureAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "azure"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -168,16 +170,18 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAzureAuth.orgId,
- properties: {
- identityId: identityAzureAuth.identityId,
- orgId: identityAzureAuth.orgId,
- authMethod: "azure"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ })
+ .catch(() => {});
return { identityAzureAuth };
}
@@ -270,16 +274,18 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAzureAuth.orgId,
- properties: {
- identityId: identityAzureAuth.identityId,
- orgId: identityAzureAuth.orgId,
- authMethod: "azure"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ })
+ .catch(() => {});
return { identityAzureAuth };
}
@@ -381,16 +387,18 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityAzureAuth.orgId,
- properties: {
- identityId: identityAzureAuth.identityId,
- orgId: identityAzureAuth.orgId,
- authMethod: "azure"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityAzureAuth.orgId,
+ properties: {
+ identityId: identityAzureAuth.identityId,
+ orgId: identityAzureAuth.orgId,
+ authMethod: "azure"
+ }
+ })
+ .catch(() => {});
return { identityAzureAuth };
}
diff --git a/backend/src/server/routes/v1/identity-gcp-auth-router.ts b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
index 8a3ec65c32..4a6d1e563a 100644
--- a/backend/src/server/routes/v1/identity-gcp-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
@@ -56,16 +56,18 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityGcpAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityGcpAuth.identityId,
- orgId: identity.orgId,
- authMethod: "gcp"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityGcpAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "gcp"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -166,16 +168,18 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityGcpAuth.orgId,
- properties: {
- identityId: identityGcpAuth.identityId,
- orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ })
+ .catch(() => {});
return { identityGcpAuth };
}
@@ -264,16 +268,18 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityGcpAuth.orgId,
- properties: {
- identityId: identityGcpAuth.identityId,
- orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ })
+ .catch(() => {});
return { identityGcpAuth };
}
@@ -375,16 +381,18 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityGcpAuth.orgId,
- properties: {
- identityId: identityGcpAuth.identityId,
- orgId: identityGcpAuth.orgId,
- authMethod: "gcp"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityGcpAuth.orgId,
+ properties: {
+ identityId: identityGcpAuth.identityId,
+ orgId: identityGcpAuth.orgId,
+ authMethod: "gcp"
+ }
+ })
+ .catch(() => {});
return { identityGcpAuth };
}
diff --git a/backend/src/server/routes/v1/identity-jwt-auth-router.ts b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
index 91c7712ebf..7ea6a0a4f3 100644
--- a/backend/src/server/routes/v1/identity-jwt-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
@@ -8,7 +8,6 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { JwtConfigurationType } from "@app/services/identity-jwt-auth/identity-jwt-auth-types";
import {
@@ -16,6 +15,7 @@ import {
validateJwtBoundClaimsField
} from "@app/services/identity-jwt-auth/identity-jwt-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const IdentityJwtAuthResponseSchema = IdentityJwtAuthsSchema.omit({
encryptedJwksCaCert: true,
@@ -132,16 +132,18 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityJwtAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityJwtAuth.identityId,
- orgId: identity.orgId,
- authMethod: "jwt"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityJwtAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "jwt"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -216,16 +218,18 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityJwtAuth.orgId,
- properties: {
- identityId: identityJwtAuth.identityId,
- orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ })
+ .catch(() => {});
return {
identityJwtAuth
@@ -296,16 +300,18 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityJwtAuth.orgId,
- properties: {
- identityId: identityJwtAuth.identityId,
- orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ })
+ .catch(() => {});
return { identityJwtAuth };
}
@@ -410,16 +416,18 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityJwtAuth.orgId,
- properties: {
- identityId: identityJwtAuth.identityId,
- orgId: identityJwtAuth.orgId,
- authMethod: "jwt"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityJwtAuth.orgId,
+ properties: {
+ identityId: identityJwtAuth.identityId,
+ orgId: identityJwtAuth.orgId,
+ authMethod: "jwt"
+ }
+ })
+ .catch(() => {});
return { identityJwtAuth };
}
diff --git a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
index 787f2e44f9..d806d9e315 100644
--- a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
@@ -9,10 +9,10 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { IdentityKubernetesAuthTokenReviewMode } from "@app/services/identity-kubernetes-auth/identity-kubernetes-auth-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const IdentityKubernetesAuthResponseSchema = IdentityKubernetesAuthsSchema.pick({
id: true,
@@ -77,16 +77,18 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityKubernetesAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityKubernetesAuth.identityId,
- orgId: identity.orgId,
- authMethod: "kubernetes"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityKubernetesAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "kubernetes"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -241,16 +243,18 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityKubernetesAuth.orgId,
- properties: {
- identityId: identityKubernetesAuth.identityId,
- orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ })
+ .catch(() => {});
return { identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.parse(identityKubernetesAuth) };
}
@@ -396,16 +400,18 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityKubernetesAuth.orgId,
- properties: {
- identityId: identityKubernetesAuth.identityId,
- orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ })
+ .catch(() => {});
return { identityKubernetesAuth };
}
@@ -510,16 +516,18 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityKubernetesAuth.orgId,
- properties: {
- identityId: identityKubernetesAuth.identityId,
- orgId: identityKubernetesAuth.orgId,
- authMethod: "kubernetes"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityKubernetesAuth.orgId,
+ properties: {
+ identityId: identityKubernetesAuth.identityId,
+ orgId: identityKubernetesAuth.orgId,
+ authMethod: "kubernetes"
+ }
+ })
+ .catch(() => {});
return { identityKubernetesAuth };
}
diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
index bbd3a31bd5..86b6e8e155 100644
--- a/backend/src/server/routes/v1/identity-ldap-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
@@ -25,10 +25,10 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { AllowedFieldsSchema } from "@app/services/identity-ldap-auth/identity-ldap-auth-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider) => {
const appCfg = getConfig();
@@ -204,16 +204,18 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${authIdentityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: authIdentityId,
- orgId: identity.orgId,
- authMethod: "ldap"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${authIdentityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: authIdentityId,
+ orgId: identity.orgId,
+ authMethod: "ldap"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -412,16 +414,18 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: req.params.identityId,
- orgId: req.permission.orgId,
- authMethod: "ldap"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ })
+ .catch(() => {});
return { identityLdapAuth };
}
@@ -545,16 +549,18 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: req.params.identityId,
- orgId: req.permission.orgId,
- authMethod: "ldap"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ })
+ .catch(() => {});
return { identityLdapAuth };
}
@@ -669,16 +675,18 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: identityLdapAuth.identityId,
- orgId: req.permission.orgId,
- authMethod: "ldap"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityLdapAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "ldap"
+ }
+ })
+ .catch(() => {});
return { identityLdapAuth };
}
diff --git a/backend/src/server/routes/v1/identity-oci-auth-router.ts b/backend/src/server/routes/v1/identity-oci-auth-router.ts
index 667c9c4e9e..0a41617551 100644
--- a/backend/src/server/routes/v1/identity-oci-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oci-auth-router.ts
@@ -8,10 +8,10 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { validateTenancy, validateUsernames } from "@app/services/identity-oci-auth/identity-oci-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -73,16 +73,18 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityOciAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityOciAuth.identityId,
- orgId: identity.orgId,
- authMethod: "oci"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityOciAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "oci"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -179,16 +181,18 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOciAuth.orgId,
- properties: {
- identityId: identityOciAuth.identityId,
- orgId: identityOciAuth.orgId,
- authMethod: "oci"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ })
+ .catch(() => {});
return { identityOciAuth };
}
@@ -274,16 +278,18 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOciAuth.orgId,
- properties: {
- identityId: identityOciAuth.identityId,
- orgId: identityOciAuth.orgId,
- authMethod: "oci"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ })
+ .catch(() => {});
return { identityOciAuth };
}
@@ -384,16 +390,18 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOciAuth.orgId,
- properties: {
- identityId: identityOciAuth.identityId,
- orgId: identityOciAuth.orgId,
- authMethod: "oci"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOciAuth.orgId,
+ properties: {
+ identityId: identityOciAuth.identityId,
+ orgId: identityOciAuth.orgId,
+ authMethod: "oci"
+ }
+ })
+ .catch(() => {});
return { identityOciAuth };
}
diff --git a/backend/src/server/routes/v1/identity-oidc-auth-router.ts b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
index 3430ec2e2b..8405b99f7c 100644
--- a/backend/src/server/routes/v1/identity-oidc-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
@@ -8,13 +8,13 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import {
validateOidcAuthAudiencesField,
validateOidcBoundClaimsField
} from "@app/services/identity-oidc-auth/identity-oidc-auth-validators";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const IdentityOidcAuthResponseSchema = IdentityOidcAuthsSchema.pick({
id: true,
@@ -84,16 +84,18 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityOidcAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityOidcAuth.identityId,
- orgId: identity.orgId,
- authMethod: "oidc"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityOidcAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "oidc"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -200,16 +202,18 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOidcAuth.orgId,
- properties: {
- identityId: identityOidcAuth.identityId,
- orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ })
+ .catch(() => {});
return {
identityOidcAuth
@@ -313,16 +317,18 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOidcAuth.orgId,
- properties: {
- identityId: identityOidcAuth.identityId,
- orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ })
+ .catch(() => {});
return { identityOidcAuth };
}
@@ -426,16 +432,18 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityOidcAuth.orgId,
- properties: {
- identityId: identityOidcAuth.identityId,
- orgId: identityOidcAuth.orgId,
- authMethod: "oidc"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityOidcAuth.orgId,
+ properties: {
+ identityId: identityOidcAuth.identityId,
+ orgId: identityOidcAuth.orgId,
+ authMethod: "oidc"
+ }
+ })
+ .catch(() => {});
return { identityOidcAuth };
}
diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.ts
index ccdd22b8cc..cc9535027f 100644
--- a/backend/src/server/routes/v1/identity-router.ts
+++ b/backend/src/server/routes/v1/identity-router.ts
@@ -164,18 +164,20 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identity.orgId,
- properties: {
- identityId: identity.id,
- orgId: identity.orgId,
- name: identity.name,
- hasDeleteProtection: identity.hasDeleteProtection,
- ...req.auditLogInfo
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identity.id,
+ orgId: identity.orgId,
+ name: identity.name,
+ hasDeleteProtection: identity.hasDeleteProtection,
+ ...req.auditLogInfo
+ }
+ })
+ .catch(() => {});
return { identity };
}
@@ -228,16 +230,18 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityDeleted,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identity.orgId,
- properties: {
- identityId: identity.id,
- orgId: identity.orgId,
- ...req.auditLogInfo
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityDeleted,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identity.id,
+ orgId: identity.orgId,
+ ...req.auditLogInfo
+ }
+ })
+ .catch(() => {});
return { identity };
}
diff --git a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
index 7a7a4ed9a7..966bbe23c8 100644
--- a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
@@ -11,9 +11,9 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const validateCommonNames = z
.string()
@@ -88,16 +88,18 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityTlsCertAuth.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityTlsCertAuth.identityId,
- orgId: identity.orgId,
- authMethod: "tls"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityTlsCertAuth.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: identity.orgId,
+ authMethod: "tls"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -206,16 +208,18 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: identityTlsCertAuth.identityId,
- orgId: req.permission.orgId,
- authMethod: "tls"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ })
+ .catch(() => {});
return { identityTlsCertAuth };
}
@@ -319,16 +323,18 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: identityTlsCertAuth.identityId,
- orgId: req.permission.orgId,
- authMethod: "tls"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ })
+ .catch(() => {});
return { identityTlsCertAuth };
}
@@ -431,16 +437,18 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: identityTlsCertAuth.identityId,
- orgId: req.permission.orgId,
- authMethod: "tls"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: identityTlsCertAuth.identityId,
+ orgId: req.permission.orgId,
+ authMethod: "tls"
+ }
+ })
+ .catch(() => {});
return { identityTlsCertAuth };
}
diff --git a/backend/src/server/routes/v1/identity-token-auth-router.ts b/backend/src/server/routes/v1/identity-token-auth-router.ts
index 6ef623b4a0..c5ed96770f 100644
--- a/backend/src/server/routes/v1/identity-token-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-token-auth-router.ts
@@ -8,9 +8,9 @@ import { slugSchema } from "@app/server/lib/schemas";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
-import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -100,16 +100,18 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityTokenAuth.orgId,
- properties: {
- identityId: identityTokenAuth.identityId,
- orgId: identityTokenAuth.orgId,
- authMethod: "token"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ })
+ .catch(() => {});
return {
identityTokenAuth
@@ -198,16 +200,18 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityTokenAuth.orgId,
- properties: {
- identityId: identityTokenAuth.identityId,
- orgId: identityTokenAuth.orgId,
- authMethod: "token"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ })
+ .catch(() => {});
return {
identityTokenAuth
@@ -312,16 +316,18 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityTokenAuth.orgId,
- properties: {
- identityId: identityTokenAuth.identityId,
- orgId: identityTokenAuth.orgId,
- authMethod: "token"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityTokenAuth.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identityTokenAuth.orgId,
+ authMethod: "token"
+ }
+ })
+ .catch(() => {});
return { identityTokenAuth };
}
@@ -385,15 +391,17 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityTokenCreated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identity.orgId,
- properties: {
- identityId: identityTokenAuth.identityId,
- orgId: identity.orgId
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityTokenCreated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityTokenAuth.identityId,
+ orgId: identity.orgId
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -660,15 +668,17 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
isActorSuperAdmin: isSuperAdmin(req.auth)
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityTokenRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: req.permission.orgId,
- properties: {
- identityId: revokedToken.identityId,
- orgId: req.permission.orgId
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityTokenRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ identityId: revokedToken.identityId,
+ orgId: req.permission.orgId
+ }
+ })
+ .catch(() => {});
return {
message: "Successfully revoked access token"
diff --git a/backend/src/server/routes/v1/identity-universal-auth-router.ts b/backend/src/server/routes/v1/identity-universal-auth-router.ts
index 703996a23d..f83c78540b 100644
--- a/backend/src/server/routes/v1/identity-universal-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-universal-auth-router.ts
@@ -79,16 +79,18 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityLogin,
- distinctId: `identity-${identityUa.identityId}`,
- organizationId: identity.orgId,
- properties: {
- identityId: identityUa.identityId,
- orgId: identity.orgId,
- authMethod: "universal_auth"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityLogin,
+ distinctId: `identity-${identityUa.identityId}`,
+ organizationId: identity.orgId,
+ properties: {
+ identityId: identityUa.identityId,
+ orgId: identity.orgId,
+ authMethod: "universal_auth"
+ }
+ })
+ .catch(() => {});
return {
accessToken,
@@ -214,16 +216,18 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityUniversalAuth.orgId,
- properties: {
- identityId: identityUniversalAuth.identityId,
- orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodAttached,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ })
+ .catch(() => {});
return { identityUniversalAuth };
}
@@ -349,16 +353,18 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityUniversalAuth.orgId,
- properties: {
- identityId: identityUniversalAuth.identityId,
- orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ })
+ .catch(() => {});
return { identityUniversalAuth };
}
@@ -460,16 +466,18 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: identityUniversalAuth.orgId,
- properties: {
- identityId: identityUniversalAuth.identityId,
- orgId: identityUniversalAuth.orgId,
- authMethod: "universal_auth"
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityAuthMethodRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: identityUniversalAuth.orgId,
+ properties: {
+ identityId: identityUniversalAuth.identityId,
+ orgId: identityUniversalAuth.orgId,
+ authMethod: "universal_auth"
+ }
+ })
+ .catch(() => {});
return { identityUniversalAuth };
}
@@ -530,15 +538,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityClientSecretCreated,
- distinctId: getTelemetryDistinctId(req),
- organizationId: orgId,
- properties: {
- identityId: req.params.identityId,
- orgId
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityClientSecretCreated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: orgId,
+ properties: {
+ identityId: req.params.identityId,
+ orgId
+ }
+ })
+ .catch(() => {});
return { clientSecret, clientSecretData };
}
@@ -697,15 +707,17 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
}
});
- void server.services.telemetry.sendPostHogEvents({
- event: PostHogEventTypes.MachineIdentityClientSecretRevoked,
- distinctId: getTelemetryDistinctId(req),
- organizationId: clientSecretData.orgId,
- properties: {
- identityId: clientSecretData.identityId,
- orgId: clientSecretData.orgId
- }
- }).catch(() => {});
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.MachineIdentityClientSecretRevoked,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: clientSecretData.orgId,
+ properties: {
+ identityId: clientSecretData.identityId,
+ orgId: clientSecretData.orgId
+ }
+ })
+ .catch(() => {});
return { clientSecretData };
}