Skip to content

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

feat(gateway): aws auth via new resource auth method abstraction (#6249)

Saif Ur Rahman88dcf008298a
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.ts
index 9f2f129b11..a25c388c21 100644
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@ -54,6 +54,7 @@ import { TProjectEventsSSEService } from "@app/ee/services/project-events/projec
import { TProjectTemplateServiceFactory } from "@app/ee/services/project-template/project-template-types";
import { RateLimitConfiguration, TRateLimitServiceFactory } from "@app/ee/services/rate-limit/rate-limit-types";
import { TRelayServiceFactory } from "@app/ee/services/relay/relay-service";
+import { TResourceAuthMethodServiceFactory } from "@app/ee/services/resource-auth-method/resource-auth-method-service";
import { TSamlConfigServiceFactory } from "@app/ee/services/saml-config/saml-config-types";
import { TScimServiceFactory } from "@app/ee/services/scim/scim-types";
import { TSecretApprovalPolicyServiceFactory } from "@app/ee/services/secret-approval-policy/secret-approval-policy-service";
@@ -372,6 +373,7 @@ declare module "fastify" {
relay: TRelayServiceFactory;
gatewayV2: TGatewayV2ServiceFactory;
gatewayPool: TGatewayPoolServiceFactory;
+ resourceAuthMethod: TResourceAuthMethodServiceFactory;
githubOrgSync: TGithubOrgSyncServiceFactory;
folderCommit: TFolderCommitServiceFactory;
pit: TPitServiceFactory;
diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.ts
index 0156cf33e7..d30417c4e4 100644
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@ -161,9 +161,6 @@ import {
TFolderTreeCheckpoints,
TFolderTreeCheckpointsInsert,
TFolderTreeCheckpointsUpdate,
- TGatewayEnrollmentTokens,
- TGatewayEnrollmentTokensInsert,
- TGatewayEnrollmentTokensUpdate,
TGatewayPoolMemberships,
TGatewayPoolMembershipsInsert,
TGatewayPoolMembershipsUpdate,
@@ -443,9 +440,18 @@ import {
TRelays,
TRelaysInsert,
TRelaysUpdate,
+ TResourceAuthMethods,
+ TResourceAuthMethodsInsert,
+ TResourceAuthMethodsUpdate,
+ TResourceAwsAuths,
+ TResourceAwsAuthsInsert,
+ TResourceAwsAuthsUpdate,
TResourceMetadata,
TResourceMetadataInsert,
TResourceMetadataUpdate,
+ TResourceTokenAuths,
+ TResourceTokenAuthsInsert,
+ TResourceTokenAuthsUpdate,
TRoles,
TRolesInsert,
TRolesUpdate,
@@ -1591,10 +1597,20 @@ declare module "knex/types/tables" {
TOrgGatewayConfigV2Update
>;
[TableName.GatewayV2]: KnexOriginal.CompositeTableType<TGatewaysV2, TGatewaysV2Insert, TGatewaysV2Update>;
- [TableName.GatewayEnrollmentTokens]: KnexOriginal.CompositeTableType<
- TGatewayEnrollmentTokens,
- TGatewayEnrollmentTokensInsert,
- TGatewayEnrollmentTokensUpdate
+ [TableName.ResourceTokenAuth]: KnexOriginal.CompositeTableType<
+ TResourceTokenAuths,
+ TResourceTokenAuthsInsert,
+ TResourceTokenAuthsUpdate
+ >;
+ [TableName.ResourceAuthMethod]: KnexOriginal.CompositeTableType<
+ TResourceAuthMethods,
+ TResourceAuthMethodsInsert,
+ TResourceAuthMethodsUpdate
+ >;
+ [TableName.ResourceAwsAuth]: KnexOriginal.CompositeTableType<
+ TResourceAwsAuths,
+ TResourceAwsAuthsInsert,
+ TResourceAwsAuthsUpdate
>;
[TableName.GatewayPool]: KnexOriginal.CompositeTableType<TGatewayPools, TGatewayPoolsInsert, TGatewayPoolsUpdate>;
[TableName.GatewayPoolMembership]: KnexOriginal.CompositeTableType<
diff --git a/backend/src/db/migrations/20260413000001_gateway-enrollment-tokens.ts b/backend/src/db/migrations/20260413000001_gateway-enrollment-tokens.ts
index 375a3e5a78..1a588fcad4 100644
--- a/backend/src/db/migrations/20260413000001_gateway-enrollment-tokens.ts
+++ b/backend/src/db/migrations/20260413000001_gateway-enrollment-tokens.ts
@@ -17,8 +17,11 @@ export async function up(knex: Knex): Promise<void> {
}
});
- if (!(await knex.schema.hasTable(TableName.GatewayEnrollmentTokens))) {
- await knex.schema.createTable(TableName.GatewayEnrollmentTokens, (t) => {
+ // Literal table name (not TableName enum) is intentional: migration 20260430143000
+ // renames this table to resource_token_auths, so the enum value no longer exists.
+ // Don't replace with the enum.
+ if (!(await knex.schema.hasTable("gateway_enrollment_tokens"))) {
+ await knex.schema.createTable("gateway_enrollment_tokens", (t) => {
t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
t.uuid("orgId").notNullable();
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
@@ -32,13 +35,13 @@ export async function up(knex: Knex): Promise<void> {
t.timestamps(true, true, true);
});
- await createOnUpdateTrigger(knex, TableName.GatewayEnrollmentTokens);
+ await createOnUpdateTrigger(knex, "gateway_enrollment_tokens");
}
}
export async function down(knex: Knex): Promise<void> {
- await dropOnUpdateTrigger(knex, TableName.GatewayEnrollmentTokens);
- await knex.schema.dropTableIfExists(TableName.GatewayEnrollmentTokens);
+ await dropOnUpdateTrigger(knex, "gateway_enrollment_tokens");
+ await knex.schema.dropTableIfExists("gateway_enrollment_tokens");
// Restore identityId to not-null and remove tokenVersion (only safe if no null rows exist)
await knex.schema.alterTable(TableName.GatewayV2, (t) => {
diff --git a/backend/src/db/migrations/20260430143000_resource-auth-methods.ts b/backend/src/db/migrations/20260430143000_resource-auth-methods.ts
new file mode 100644
index 0000000000..ba6d9e2a5d
--- /dev/null
+++ b/backend/src/db/migrations/20260430143000_resource-auth-methods.ts
@@ -0,0 +1,200 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+const OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE = "gateway_enrollment_tokens";
+
+export async function up(knex: Knex): Promise<void> {
+ // 1. Rename gateway_enrollment_tokens -> resource_token_auths (column-compatible).
+ const hasOldEnrollmentTokensTable = await knex.schema.hasTable(OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE);
+ const hasNewEnrollmentTokensTable = await knex.schema.hasTable(TableName.ResourceTokenAuth);
+ if (hasOldEnrollmentTokensTable && !hasNewEnrollmentTokensTable) {
+ await knex.schema.renameTable(OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE, TableName.ResourceTokenAuth);
+ }
+
+ // 2. resource_auth_methods: registry of which auth method each resource is currently
+ // using. Single source of truth for "this resource uses this method" — config tables
+ // (resource_aws_auths) and credential tables (resource_token_auths) reference
+ // this row's id rather than carrying the resource FK themselves.
+ //
+ // gatewayId is nullable so this table can hold rows for other resource types in the
+ // future (each gets its own nullable FK column — matches the resource_metadata
+ // convention used elsewhere in the schema).
+ //
+ // The "one method per gateway" rule is encoded via a *partial* unique index rather
+ // than a strict UNIQUE constraint, so additional resource types can co-exist on this
+ // table with their own constraint shape:
+ //
+ // - Single-method resources (one method active per resource at a time):
+ // CREATE UNIQUE INDEX one_method_per_<resource>
+ // ON resource_auth_methods (<resource>Id)
+ // WHERE <resource>Id IS NOT NULL;
+ //
+ // - Multi-method resources (multiple methods may be active at once, but each
+ // method must appear at most once per resource):
+ // CREATE UNIQUE INDEX no_duplicate_method_per_<resource>
+ // ON resource_auth_methods (<resource>Id, method)
+ // WHERE <resource>Id IS NOT NULL;
+ //
+ // Both shapes coexist peacefully on this table — they activate on different rows
+ // based on which FK column is set.
+ if (!(await knex.schema.hasTable(TableName.ResourceAuthMethod))) {
+ await knex.schema.createTable(TableName.ResourceAuthMethod, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.uuid("gatewayId").nullable();
+ t.foreign("gatewayId").references("id").inTable(TableName.GatewayV2).onDelete("CASCADE");
+ t.string("method").notNullable();
+ t.timestamps(true, true, true);
+ });
+
+ await knex.schema.raw(`
+ CREATE UNIQUE INDEX one_method_per_gateway
+ ON ${TableName.ResourceAuthMethod} ("gatewayId")
+ WHERE "gatewayId" IS NOT NULL
+ `);
+
+ await createOnUpdateTrigger(knex, TableName.ResourceAuthMethod);
+ }
+
+ // 3. Backfill registry. Only gateways *without* identityId get rows here — those were
+ // created via main's token-flow (or are about to be configured). Identity-bound
+ // gateways are deliberately *not* given a registry row; they're the legacy state
+ // and detected at read time via gateways_v2.identityId IS NOT NULL. Switching
+ // method on a legacy gateway isn't supported — operators are pointed at
+ // "Create a new gateway" instead.
+ await knex.raw(
+ `INSERT INTO ?? ("gatewayId", method)
+ SELECT id, 'token' FROM ?? WHERE "identityId" IS NULL
+ ON CONFLICT DO NOTHING`,
+ [TableName.ResourceAuthMethod, TableName.GatewayV2]
+ );
+
+ // 4. resource_aws_auths: AWS-method config. Keyed by authMethodId (FK to registry),
+ // not by gatewayId — registry is the single source of truth for resource ownership.
+ // Same table shape will serve any future resource type with no column changes.
+ if (!(await knex.schema.hasTable(TableName.ResourceAwsAuth))) {
+ await knex.schema.createTable(TableName.ResourceAwsAuth, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+ t.uuid("authMethodId").notNullable().unique();
+ t.foreign("authMethodId").references("id").inTable(TableName.ResourceAuthMethod).onDelete("CASCADE");
+ t.string("stsEndpoint").notNullable();
+ t.string("allowedPrincipalArns", 4096).notNullable().defaultTo("");
+ t.string("allowedAccountIds", 2048).notNullable().defaultTo("");
+ t.timestamps(true, true, true);
+ });
+
+ await createOnUpdateTrigger(knex, TableName.ResourceAwsAuth);
+ }
+
+ // 5. Reshape resource_token_auths from gatewayId-keyed to authMethodId-keyed.
+ // After this block the table no longer carries gatewayId at all — the registry row
+ // is the only place that knows which resource a token belongs to.
+ if (await knex.schema.hasColumn(TableName.ResourceTokenAuth, "gatewayId")) {
+ await knex.schema.alterTable(TableName.ResourceTokenAuth, (t) => {
+ t.uuid("authMethodId").nullable();
+ });
+
+ // Backfill authMethodId from registry. Only token-method gateways have valid
+ // mappings (a token row for a gateway now on identity method is an orphan).
+ // usedAt filter: in the new model, row existence means "unused" — consumed
+ // rows must not be carried over or they become replayable.
+ await knex.raw(
+ `UPDATE ?? AS t
+ SET "authMethodId" = m.id
+ FROM ?? AS m
+ WHERE m."gatewayId" = t."gatewayId"
+ AND m.method = 'token'
+ AND t."usedAt" IS NULL`,
+ [TableName.ResourceTokenAuth, TableName.ResourceAuthMethod]
+ );
+
+ // Scrub orphans — tokens whose gateway is now on a non-token method.
+ await knex.raw(`DELETE FROM ?? WHERE "authMethodId" IS NULL`, [TableName.ResourceTokenAuth]);
+
+ await knex.schema.alterTable(TableName.ResourceTokenAuth, (t) => {
+ t.uuid("authMethodId").notNullable().alter();
+ t.foreign("authMethodId").references("id").inTable(TableName.ResourceAuthMethod).onDelete("CASCADE");
+ t.dropColumn("gatewayId");
+ // usedAt is gone — token rows are deleted on consume rather than marked. Existence
+ // of a row means "unused"; absence means "either never existed or already consumed."
+ // Simpler model: no flag to filter on, no audit-of-used-tokens semantic to maintain.
+ t.dropColumn("usedAt");
+ });
+ }
+
+ // 6. Rename leftover indexes/constraints/triggers from the old table name. Pure
+ // metadata cleanup — Postgres preserves the original names through renameTable, and
+ // we want them to match the new table name for clarity.
+ await knex.raw(
+ `ALTER INDEX IF EXISTS gateway_enrollment_tokens_pkey
+ RENAME TO resource_token_auths_pkey`
+ );
+ await knex.raw(
+ `ALTER INDEX IF EXISTS gateway_enrollment_tokens_tokenhash_unique
+ RENAME TO resource_token_auths_tokenhash_unique`
+ );
+ await knex.raw(
+ `ALTER TABLE ?? RENAME CONSTRAINT gateway_enrollment_tokens_orgid_foreign
+ TO resource_token_auths_orgid_foreign`,
+ [TableName.ResourceTokenAuth]
+ );
+ // Trigger: drop the old name and recreate via the helper using the new table name.
+ // (gateway_enrollment_tokens_gatewayid_foreign was dropped automatically when we
+ // dropped the gatewayId column above.)
+ await knex.raw(`DROP TRIGGER IF EXISTS "gateway_enrollment_tokens_updatedAt" ON ??`, [TableName.ResourceTokenAuth]);
+ await createOnUpdateTrigger(knex, TableName.ResourceTokenAuth);
+}
+
+export async function down(knex: Knex): Promise<void> {
+ // Reverse step 5: enrollment-tokens table back to gatewayId-keyed.
+ if (await knex.schema.hasColumn(TableName.ResourceTokenAuth, "authMethodId")) {
+ await knex.schema.alterTable(TableName.ResourceTokenAuth, (t) => {
+ t.uuid("gatewayId").nullable();
+ t.timestamp("usedAt").nullable();
+ });
+ await knex.raw(
+ `UPDATE ?? AS t
+ SET "gatewayId" = m."gatewayId"
+ FROM ?? AS m
+ WHERE m.id = t."authMethodId"`,
+ [TableName.ResourceTokenAuth, TableName.ResourceAuthMethod]
+ );
+ await knex.schema.alterTable(TableName.ResourceTokenAuth, (t) => {
+ t.foreign("gatewayId").references("id").inTable(TableName.GatewayV2).onDelete("CASCADE");
+ t.dropColumn("authMethodId");
+ });
+ }
+
+ // Reverse step 4 + step 2: drop AWS-config and registry tables.
+ await dropOnUpdateTrigger(knex, TableName.ResourceAwsAuth);
+ await knex.schema.dropTableIfExists(TableName.ResourceAwsAuth);
+ await dropOnUpdateTrigger(knex, TableName.ResourceAuthMethod);
+ await knex.schema.dropTableIfExists(TableName.ResourceAuthMethod);
+
+ // Reverse step 1: rename back. Triggers/indexes on the renamed table revert to the
+ // old names too (done before the table rename so the SQL can resolve names).
+ await knex.raw(`DROP TRIGGER IF EXISTS "resource_token_auths_updatedAt" ON ??`, [TableName.ResourceTokenAuth]);
+ await knex.raw(
+ `ALTER TABLE ?? RENAME CONSTRAINT resource_token_auths_orgid_foreign
+ TO gateway_enrollment_tokens_orgid_foreign`,
+ [TableName.ResourceTokenAuth]
+ );
+ await knex.raw(
+ `ALTER INDEX IF EXISTS resource_token_auths_tokenhash_unique
+ RENAME TO gateway_enrollment_tokens_tokenhash_unique`
+ );
+ await knex.raw(
+ `ALTER INDEX IF EXISTS resource_token_auths_pkey
+ RENAME TO gateway_enrollment_tokens_pkey`
+ );
+
+ const hasNewEnrollmentTokensTable = await knex.schema.hasTable(TableName.ResourceTokenAuth);
+ const hasOldEnrollmentTokensTable = await knex.schema.hasTable(OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE);
+ if (hasNewEnrollmentTokensTable && !hasOldEnrollmentTokensTable) {
+ await knex.schema.renameTable(TableName.ResourceTokenAuth, OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE);
+ }
+
+ // Recreate the trigger using the old table name.
+ await createOnUpdateTrigger(knex, OLD_GATEWAY_ENROLLMENT_TOKENS_TABLE);
+}
diff --git a/backend/src/db/schemas/gateway-enrollment-tokens.ts b/backend/src/db/schemas/gateway-enrollment-tokens.ts
deleted file mode 100644
index 99cc5ebfd6..0000000000
--- a/backend/src/db/schemas/gateway-enrollment-tokens.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-// Code generated by automation script, DO NOT EDIT.
-// Automated by pulling database and generating zod schema
-// To update. Just run npm run generate:schema
-// Written by akhilmhdh.
-
-import { z } from "zod";
-
-import { TImmutableDBKeys } from "./models";
-
-export const GatewayEnrollmentTokensSchema = z.object({
- id: z.string().uuid(),
- orgId: z.string().uuid(),
- tokenHash: z.string(),
- ttl: z.number().default(3600),
- expiresAt: z.date(),
- usedAt: z.date().nullable().optional(),
- gatewayId: z.string().uuid().nullable().optional(),
- createdAt: z.date(),
- updatedAt: z.date()
-});
-
-export type TGatewayEnrollmentTokens = z.infer<typeof GatewayEnrollmentTokensSchema>;
-export type TGatewayEnrollmentTokensInsert = Omit<z.input<typeof GatewayEnrollmentTokensSchema>, TImmutableDBKeys>;
-export type TGatewayEnrollmentTokensUpdate = Partial<
- Omit<z.input<typeof GatewayEnrollmentTokensSchema>, TImmutableDBKeys>
->;
diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.ts
index 1550e17aea..e1c16cfb7d 100644
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@ -53,7 +53,6 @@ export * from "./folder-commit-changes";
export * from "./folder-commits";
export * from "./folder-tree-checkpoint-resources";
export * from "./folder-tree-checkpoints";
-export * from "./gateway-enrollment-tokens";
export * from "./gateway-pool-memberships";
export * from "./gateway-pools";
export * from "./gateways";
@@ -180,7 +179,10 @@ export * from "./project-user-membership-roles";
export * from "./projects";
export * from "./rate-limit";
export * from "./relays";
+export * from "./resource-auth-methods";
+export * from "./resource-aws-auths";
export * from "./resource-metadata";
+export * from "./resource-token-auths";
export * from "./roles";
export * from "./saml-configs";
export * from "./scim-events";
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.ts
index ac77650e83..690ed60814 100644
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@ -218,7 +218,9 @@ export enum TableName {
OrgGatewayConfigV2 = "org_gateway_config_v2",
Relay = "relays",
GatewayV2 = "gateways_v2",
- GatewayEnrollmentTokens = "gateway_enrollment_tokens",
+ ResourceAuthMethod = "resource_auth_methods",
+ ResourceAwsAuth = "resource_aws_auths",
+ ResourceTokenAuth = "resource_token_auths",
GatewayPool = "gateway_pools",
GatewayPoolMembership = "gateway_pool_memberships",
diff --git a/backend/src/db/schemas/resource-auth-methods.ts b/backend/src/db/schemas/resource-auth-methods.ts
new file mode 100644
index 0000000000..728192dd69
--- /dev/null
+++ b/backend/src/db/schemas/resource-auth-methods.ts
@@ -0,0 +1,20 @@
+// Code generated by automation script, DO NOT EDIT.
+// Automated by pulling database and generating zod schema
+// To update. Just run npm run generate:schema
+// Written by akhilmhdh.
+
+import { z } from "zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const ResourceAuthMethodsSchema = z.object({
+ id: z.string().uuid(),
+ gatewayId: z.string().uuid().nullable().optional(),
+ method: z.string(),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+export type TResourceAuthMethods = z.infer<typeof ResourceAuthMethodsSchema>;
+export type TResourceAuthMethodsInsert = Omit<z.input<typeof ResourceAuthMethodsSchema>, TImmutableDBKeys>;
+export type TResourceAuthMethodsUpdate = Partial<Omit<z.input<typeof ResourceAuthMethodsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/resource-aws-auths.ts b/backend/src/db/schemas/resource-aws-auths.ts
new file mode 100644
index 0000000000..48532c784c
--- /dev/null
+++ b/backend/src/db/schemas/resource-aws-auths.ts
@@ -0,0 +1,22 @@
+// Code generated by automation script, DO NOT EDIT.
+// Automated by pulling database and generating zod schema
+// To update. Just run npm run generate:schema
+// Written by akhilmhdh.
+
+import { z } from "zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const ResourceAwsAuthsSchema = z.object({
+ id: z.string().uuid(),
+ authMethodId: z.string().uuid(),
+ stsEndpoint: z.string(),
+ allowedPrincipalArns: z.string().default(""),
+ allowedAccountIds: z.string().default(""),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+export type TResourceAwsAuths = z.infer<typeof ResourceAwsAuthsSchema>;
+export type TResourceAwsAuthsInsert = Omit<z.input<typeof ResourceAwsAuthsSchema>, TImmutableDBKeys>;
+export type TResourceAwsAuthsUpdate = Partial<Omit<z.input<typeof ResourceAwsAuthsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/resource-token-auths.ts b/backend/src/db/schemas/resource-token-auths.ts
new file mode 100644
index 0000000000..17eb001602
--- /dev/null
+++ b/backend/src/db/schemas/resource-token-auths.ts
@@ -0,0 +1,23 @@
+// Code generated by automation script, DO NOT EDIT.
+// Automated by pulling database and generating zod schema
+// To update. Just run npm run generate:schema
+// Written by akhilmhdh.
+
+import { z } from "zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const ResourceTokenAuthsSchema = z.object({
+ id: z.string().uuid(),
+ orgId: z.string().uuid(),
+ tokenHash: z.string(),
+ ttl: z.number().default(3600),
+ expiresAt: z.date(),
+ createdAt: z.date(),
+ updatedAt: z.date(),
+ authMethodId: z.string().uuid()
+});
+
+export type TResourceTokenAuths = z.infer<typeof ResourceTokenAuthsSchema>;
+export type TResourceTokenAuthsInsert = Omit<z.input<typeof ResourceTokenAuthsSchema>, TImmutableDBKeys>;
+export type TResourceTokenAuthsUpdate = Partial<Omit<z.input<typeof ResourceTokenAuthsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/ee/routes/v2/gateway-router.ts b/backend/src/ee/routes/v2/gateway-router.ts
index ccf9d5e3a0..2d91c321db 100644
--- a/backend/src/ee/routes/v2/gateway-router.ts
+++ b/backend/src/ee/routes/v2/gateway-router.ts
@@ -92,8 +92,7 @@ export const registerGatewayV2Router = async (server: FastifyZodProvider) => {
response: {
200: SanitizedGatewayV2Schema.extend({
identity: z.object({ name: z.string(), id: z.string() }).nullable(),
- connectedResourcesCount: z.number(),
- enrollmentTokenStatus: z.enum(["pending", "expired"]).nullable()
+ connectedResourcesCount: z.number()
}).array()
}
},
diff --git a/backend/src/ee/routes/v3/gateway-router.ts b/backend/src/ee/routes/v3/gateway-router.ts
index eea110b64f..740715966a 100644
--- a/backend/src/ee/routes/v3/gateway-router.ts
+++ b/backend/src/ee/routes/v3/gateway-router.ts
@@ -2,12 +2,18 @@ import z from "zod";
import { GatewaysV2Schema } from "@app/db/schemas";
import { EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
-import { writeLimit } from "@app/server/config/rateLimiter";
-import { slugSchema } from "@app/server/lib/schemas";
+import { validateAccountIds, validatePrincipalArns } from "@app/ee/services/resource-auth-method/aws-auth-validators";
+import { ResourceAuthMethodType } from "@app/ee/services/resource-auth-method/resource-auth-method-fns";
+import { ApiDocsTags, GATEWAYS } from "@app/lib/api-docs";
+import { UnauthorizedError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
+import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
-const enrollRateLimit = { windowMs: 60 * 1000, max: 10 };
+const loginRateLimit = { windowMs: 60 * 1000, max: 10 };
const SanitizedGatewayV2Schema = GatewaysV2Schema.pick({
id: true,
@@ -17,59 +23,232 @@ const SanitizedGatewayV2Schema = GatewaysV2Schema.pick({
updatedAt: true,
heartbeat: true,
lastHealthCheckStatus: true
+}).extend({
+ canRevoke: z.boolean()
});
+const AwsAuthMethodConfigSchema = z.object({
+ id: z.string().uuid(),
+ stsEndpoint: z.string(),
+ allowedPrincipalArns: z.string(),
+ allowedAccountIds: z.string(),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+const TokenAuthMethodConfigSchema = z.object({});
+
+const IdentityAuthMethodConfigSchema = z.object({
+ identityId: z.string(),
+ identityName: z.string().nullable()
+});
+
+const AuthMethodViewSchema = z.discriminatedUnion("method", [
+ z.object({ method: z.literal(ResourceAuthMethodType.Aws), config: AwsAuthMethodConfigSchema }),
+ z.object({ method: z.literal(ResourceAuthMethodType.Token), config: TokenAuthMethodConfigSchema }),
+ z.object({ method: z.literal(ResourceAuthMethodType.Identity), config: IdentityAuthMethodConfigSchema })
+]);
+
+const GatewayWithAuthMethodSchema = SanitizedGatewayV2Schema.extend({
+ authMethod: AuthMethodViewSchema
+});
+
+const AwsAuthMethodInputSchema = z
+ .object({
+ method: z.literal(ResourceAuthMethodType.Aws),
+ stsEndpoint: z
+ .string()
+ .trim()
+ .min(1)
+ .default("https://sts.amazonaws.com/")
+ .describe(GATEWAYS.AUTH_METHOD.stsEndpoint),
+ allowedPrincipalArns: validatePrincipalArns.describe(GATEWAYS.AUTH_METHOD.allowedPrincipalArns),
+ allowedAccountIds: validateAccountIds.describe(GATEWAYS.AUTH_METHOD.allowedAccountIds)
+ })
+ .refine((data) => data.allowedPrincipalArns.trim().length > 0 || data.allowedAccountIds.trim().length > 0, {
+ message: "At least one of allowedPrincipalArns or allowedAccountIds must be set",
+ path: ["allowedPrincipalArns"]
+ });
+
+const TokenAuthMethodInputSchema = z.object({
+ method: z.literal(ResourceAuthMethodType.Token)
+});
+
+// Settable methods only — `identity` is read-only and never accepted as input.
+const SettableAuthMethodInputSchema = z.union([AwsAuthMethodInputSchema, TokenAuthMethodInputSchema]);
+
export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
- // Create a gateway
+ // ─── POST / ──────────────────────────────────────────────────────────────
+ // Create a gateway. Body requires `authMethod` so create-and-configure happen in one call.
server.route({
method: "POST",
url: "/",
config: { rateLimit: writeLimit },
schema: {
operationId: "createGateway",
+ tags: [ApiDocsTags.GatewaysV3],
body: z.object({
- name: slugSchema({ min: 1, max: 64, field: "name" })
+ name: z.string().trim().min(1).max(64).describe(GATEWAYS.CREATE.name),
+ authMethod: SettableAuthMethodInputSchema.describe(GATEWAYS.CREATE.authMethod)
}),
response: {
- 200: SanitizedGatewayV2Schema
+ 200: GatewayWithAuthMethodSchema
}
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
+ const authMethodArg =
+ req.body.authMethod.method === ResourceAuthMethodType.Aws
+ ? {
+ method: ResourceAuthMethodType.Aws,
+ config: {
+ stsEndpoint: req.body.authMethod.stsEndpoint,
+ allowedPrincipalArns: req.body.authMethod.allowedPrincipalArns,
+ allowedAccountIds: req.body.authMethod.allowedAccountIds
+ }
+ }
+ : { method: ResourceAuthMethodType.Token };
+
const gateway = await server.services.gatewayV2.createGateway({
orgId: req.permission.orgId,
actorId: req.permission.id,
actorType: req.permission.type,
actorAuthMethod: req.permission.authMethod,
- name: req.body.name
+ name: req.body.name,
+ authMethod: authMethodArg
});
+ const view = await server.services.resourceAuthMethod.loadView(gateway.id);
+ if (!view) throw new UnauthorizedError({ message: "Auth method missing after create" });
+
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
orgId: req.permission.orgId,
event: {
type: EventType.GATEWAY_CREATE,
- metadata: {
- gatewayId: gateway.id,
- name: req.body.name
- }
+ metadata: { gatewayId: gateway.id, name: gateway.name }
}
});
- return gateway;
+ const canRevoke = await server.services.resourceAuthMethod.canRevoke(gateway);
+ return { ...gateway, canRevoke, authMethod: view };
}
});
- // Generate enrollment token for a gateway
+ // ─── GET /:gatewayId ─────────────────────────────────────────────────────
+ // Single-gateway read — powers the details page.
server.route({
- method: "POST",
- url: "/:gatewayId/token-auth/configure",
+ method: "GET",
+ url: "/:gatewayId",
+ config: { rateLimit: readLimit },
+ schema: {
+ operationId: "getGateway",
+ tags: [ApiDocsTags.GatewaysV3],
+ params: z.object({ gatewayId: z.string().trim().uuid() }),
+ response: { 200: GatewayWithAuthMethodSchema }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const gateway = await server.services.gatewayV2.getGatewayById({ gatewayId: req.params.gatewayId });
+ const view = await server.services.resourceAuthMethod.getByGatewayId({
+ resource: { type: "gateway", id: req.params.gatewayId },
+ actor: req.permission
+ });
+ const canRevoke = await server.services.resourceAuthMethod.canRevoke(gateway);
+ return { ...gateway, canRevoke, authMethod: view };
+ }
+ });
+
+ // ─── PATCH /:gatewayId ───────────────────────────────────────────────────
+ server.route({
+ method: "PATCH",
+ url: "/:gatewayId",
config: { rateLimit: writeLimit },
schema: {
- operationId: "configureGatewayTokenAuth",
- params: z.object({
- gatewayId: z.string().uuid()
+ operationId: "updateGateway",
+ tags: [ApiDocsTags.GatewaysV3],
+ params: z.object({ gatewayId: z.string().trim().uuid() }),
+ body: z.object({
+ authMethod: SettableAuthMethodInputSchema.optional().describe(GATEWAYS.UPDATE.authMethod)
}),
+ response: { 200: GatewayWithAuthMethodSchema }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ if (req.body.authMethod) {
+ const setInput =
+ req.body.authMethod.method === ResourceAuthMethodType.Aws
+ ? {
+ method: ResourceAuthMethodType.Aws,
+ stsEndpoint: req.body.authMethod.stsEndpoint,
+ allowedPrincipalArns: req.body.authMethod.allowedPrincipalArns,
+ allowedAccountIds: req.body.authMethod.allowedAccountIds
+ }
+ : { method: ResourceAuthMethodType.Token };
+
+ const result = await server.services.resourceAuthMethod.setMethod({
+ resource: { type: "gateway", id: req.params.gatewayId },
+ authMethod: setInput,
+ actor: req.permission
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_UPDATE,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: req.params.gatewayId,
+ method: result.method as "aws" | "token",
+ methodConfigId: result.method === ResourceAuthMethodType.Aws ? result.config.id : req.params.gatewayId,
+ ...(result.method === ResourceAuthMethodType.Aws
+ ? {
+ stsEndpoint: result.config.stsEndpoint,
+ allowedPrincipalArns: result.config.allowedPrincipalArns,
+ allowedAccountIds: result.config.allowedAccountIds
+ }
+ : {})
+ }
+ }
+ });
+
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.ResourceAuthMethodUpdated,
+ distinctId: getTelemetryDistinctId(req),
+ organizationId: req.permission.orgId,
+ properties: {
+ resourceType: "gateway",
+ resourceId: req.params.gatewayId,
+ orgId: req.permission.orgId,
+ method: result.method as "aws" | "token"
+ }
+ })
+ .catch((err) => {
+ logger.error(err, `Failed to send telemetry [gatewayId=${req.params.gatewayId}]`);
+ });
+ }
+
+ const gateway = await server.services.gatewayV2.getGatewayById({ gatewayId: req.params.gatewayId });
+ const view = await server.services.resourceAuthMethod.getByGatewayId({
+ resource: { type: "gateway", id: req.params.gatewayId },
+ actor: req.permission
+ });
+ const canRevoke = await server.services.resourceAuthMethod.canRevoke(gateway);
+ return { ...gateway, canRevoke, authMethod: view };
+ }
+ });
+
+ // ─── POST /:gatewayId/token-auth/generate-enrollment-token ────────────────
+ server.route({
+ method: "POST",
+ url: "/:gatewayId/token-auth/generate-enrollment-token",
+ config: { rateLimit: writeLimit },
+ schema: {
+ operationId: "mintGatewayEnrollmentToken",
+ tags: [ApiDocsTags.GatewaysV3],
+ params: z.object({ gatewayId: z.string().trim().uuid() }),
response: {
200: z.object({
token: z.string(),
@@ -79,9 +258,9 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => {
- const result = await server.services.gatewayV2.configureTokenAuth({
- orgPermission: req.permission,
- gatewayId: req.params.gatewayId
+ const result = await server.services.resourceAuthMethod.mintToken({
+ resource: { type: "gateway", id: req.params.gatewayId },
+ actor: req.permission
});
await server.services.auditLog.createAuditLog({
@@ -89,51 +268,244 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
orgId: req.permission.orgId,
event: {
type: EventType.GATEWAY_ENROLLMENT_TOKEN_CREATE,
+ metadata: { tokenId: result.id, name: result.gatewayName }
+ }
+ });
+
+ return { token: result.token, expiresAt: result.expiresAt };
+ }
+ });
+
+ // ─── POST /:gatewayId/revoke ─────────────────────────────────────────────
+ // Disconnect the running gateway and invalidate any outstanding enrollment tokens.
+ server.route({
+ method: "POST",
+ url: "/:gatewayId/revoke",
+ config: { rateLimit: writeLimit },
+ schema: {
+ operationId: "revokeGatewayAccess",
+ tags: [ApiDocsTags.GatewaysV3],
+ params: z.object({ gatewayId: z.string().trim().uuid() }),
+ response: {
+ 200: z.object({
+ method: z.enum(["aws", "token"]),
+ deletedTokenCount: z.number()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const result = await server.services.resourceAuthMethod.revokeAccess({
+ resource: { type: "gateway", id: req.params.gatewayId },
+ actor: req.permission
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_REVOKE,
metadata: {
- tokenId: result.id,
- name: result.gatewayName
+ resourceType: "gateway",
+ resourceId: req.params.gatewayId,
+ method: result.method,
+ gatewayName: result.gatewayName,
+ deletedTokenCount: result.deletedTokenCount
}
}
});
- return { token: result.token, expiresAt: result.expiresAt };
+ return { method: result.method, deletedTokenCount: result.deletedTokenCount };
}
});
- // Enroll a gateway using a token (unauthenticated)
+ // ─── POST /login ─────────────────────────────────────────────────────────
+ // Gateway login. Discriminated body covers both methods. Single rate limit (10/min).
server.route({
method: "POST",
- url: "/token-auth/enroll",
- config: { rateLimit: enrollRateLimit },
+ url: "/login",
+ config: { rateLimit: loginRateLimit },
schema: {
- operationId: "enrollGatewayWithToken",
- body: z.object({
- token: z.string().min(1)
- }),
+ operationId: "loginGateway",
+ tags: [ApiDocsTags.GatewaysV3],
+ description: "Gateway login. Body discriminates on `method` for AWS or token authentication.",
+ body: z.discriminatedUnion("method", [
+ z.object({
+ method: z.literal(ResourceAuthMethodType.Aws),
+ gatewayId: z.string().trim().uuid().describe(GATEWAYS.LOGIN.gatewayId),
+ iamHttpRequestMethod: z.string().default("POST").describe(GATEWAYS.LOGIN.iamHttpRequestMethod),
+ iamRequestBody: z.string().describe(GATEWAYS.LOGIN.iamRequestBody),
+ iamRequestHeaders: z.string().describe(GATEWAYS.LOGIN.iamRequestHeaders)
+ }),
+ z.object({
+ method: z.literal(ResourceAuthMethodType.Token),
+ token: z.string().min(1).describe(GATEWAYS.LOGIN.token)
+ })
+ ]),
response: {
200: z.object({
accessToken: z.string(),
- gatewayId: z.string()
+ gatewayId: z.string(),
+ tokenType: z.literal("Bearer")
})
}
},
handler: async (req) => {
- const result = await server.services.gatewayV2.enrollGateway({
- token: req.body.token
- });
+ if (req.body.method === ResourceAuthMethodType.Aws) {
+ try {
+ const result = await server.services.resourceAuthMethod.loginWithAws({
+ resource: { type: "gateway", id: req.body.gatewayId },
+ iamHttpRequestMethod: req.body.iamHttpRequestMethod,
+ iamRequestBody: req.body.iamRequestBody,
+ iamRequestHeaders: req.body.iamRequestHeaders
+ });
+
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: result.gateway.orgId,
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: result.gateway.id } },
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: result.gateway.id,
+ method: "aws",
+ methodConfigId: result.config.id,
+ principalArn: result.principalArn,
+ accountId: result.accountId
+ }
+ },
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.OTHER
+ })
+ .catch(() => {});
+
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.ResourceAuthMethodLogin,
+ distinctId: `gateway-${result.gateway.id}`,
+ organizationId: result.gateway.orgId,
+ properties: {
+ resourceType: "gateway",
+ resourceId: result.gateway.id,
+ orgId: result.gateway.orgId,
+ method: "aws"
+ }
+ })
+ .catch((err) => {
+ logger.error(err, `Failed to send telemetry [gatewayId=${result.gateway.id}]`);
+ });
+
+ return {
+ accessToken: result.accessToken,
+ gatewayId: result.gateway.id,
+ tokenType: "Bearer" as const
+ };
+ } catch (error) {
+ if (error instanceof UnauthorizedError && error.detail?.gatewayId) {
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: error.detail.orgId as string,
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: error.detail.gatewayId as string } },
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN_FAILED,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: error.detail.gatewayId as string,
+ method: "aws",
+ reasonCode: error.detail.reasonCode as string,
+ message: error.message,
+ principalArn: error.detail.principalArn as string | undefined,
+ accountId: error.detail.accountId as string | undefined
+ }
+ },
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.OTHER
+ })
+ .catch(() => {});
+ }
+ throw error;
+ }
+ }
+
+ const result = await server.services.resourceAuthMethod.loginWithToken({ token: req.body.token });
await server.services.auditLog
.createAuditLog({
orgId: result.orgId,
- actor: {
- type: ActorType.GATEWAY,
- metadata: { gatewayId: result.gatewayId }
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: result.gatewayId } },
+ event: {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,
+ metadata: {
+ resourceType: "gateway",
+ resourceId: result.gatewayId,
+ method: "token",
+ methodConfigId: result.gatewayId,
+ enrollmentTokenId: result.enrollmentTokenId
+ }
},
+ ipAddress: req.ip,
+ userAgent: req.headers["user-agent"] ?? "",
+ userAgentType: UserAgentType.CLI
+ })
+ .catch(() => {});
+
+ void server.services.telemetry
+ .sendPostHogEvents({
+ event: PostHogEventTypes.ResourceAuthMethodLogin,
+ distinctId: `gateway-${result.gatewayId}`,
+ organizationId: result.orgId,
+ properties: {
+ resourceType: "gateway",
+ resourceId: result.gatewayId,
+ orgId: result.orgId,
+ method: "token"
+ }
+ })
+ .catch((err) => {
+ logger.error(err, `Failed to send telemetry [gatewayId=${result.gatewayId}]`);
+ });
+
+ return {
+ accessToken: result.accessToken,
+ gatewayId: result.gatewayId,
+ tokenType: "Bearer" as const
+ };
+ }
+ });
+
+ // ─── POST /token-auth/enroll (DEPRECATED) ────────────────────────────────
+ // Kept for deployed gateway CLIs that hardcode this URL. New CLIs hit POST /v3/gateways/login.
+ server.route({
+ method: "POST",
+ url: "/token-auth/enroll",
+ config: { rateLimit: loginRateLimit },
+ schema: {
+ operationId: "enrollGatewayWithToken",
+ deprecated: true,
+ description: 'Deprecated. Use POST /v3/gateways/login with body { method: "token", token } instead.',
+ body: z.object({ token: z.string().min(1) }),
+ response: {
+ 200: z.object({ accessToken: z.string(), gatewayId: z.string() })
+ }
+ },
+ handler: async (req) => {
+ const result = await server.services.resourceAuthMethod.loginWithToken({ token: req.body.token });
+
+ await server.services.auditLog
+ .createAuditLog({
+ orgId: result.orgId,
+ actor: { type: ActorType.GATEWAY, metadata: { gatewayId: result.gatewayId } },
event: {
- type: EventType.GATEWAY_ENROLL,
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN,
metadata: {
- gatewayId: result.gatewayId,
- name: result.gatewayName
+ resourceType: "gateway",
+ resourceId: result.gatewayId,
+ method: "token",
+ methodConfigId: result.gatewayId,
+ enrollmentTokenId: result.enrollmentTokenId
}
},
ipAddress: req.ip,
@@ -142,11 +514,12 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
})
.catch(() => {});
- return result;
+ return { accessToken: result.accessToken, gatewayId: result.gatewayId };
}
});
- // Connect (refresh certs) for an enrolled gateway
+ // ─── POST /connect ───────────────────────────────────────────────────────
+ // Gateway connect.
server.route({
method: "POST",
url: "/connect",
@@ -154,7 +527,7 @@ export const registerGatewayV3Router = async (server: FastifyZodProvider) => {
schema: {
operationId: "connectGateway",
body: z.object({
- relayName: slugSchema({ min: 1, max: 32, field: "relayName" }).optional()
+ relayName: z.string().trim().min(1).max(32).optional()
}),
response: {
200: z.object({
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 2c395f87bd..67fa43a18a 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -790,6 +790,12 @@ export enum EventType {
GATEWAY_ENROLLMENT_TOKEN_CREATE = "gateway-enrollment-token-create",
GATEWAY_ENROLL = "gateway-enroll",
+ // Resource Auth Methods
+ RESOURCE_AUTH_METHOD_LOGIN = "resource-auth-method-login",
+ RESOURCE_AUTH_METHOD_LOGIN_FAILED = "resource-auth-method-login-failed",
+ RESOURCE_AUTH_METHOD_UPDATE = "resource-auth-method-update",
+ RESOURCE_AUTH_METHOD_REVOKE = "resource-auth-method-revoke",
+
// Gateway Pools
GATEWAY_POOL_CREATE = "gateway-pool-create",
GATEWAY_POOL_UPDATE = "gateway-pool-update",
@@ -6264,6 +6270,58 @@ interface GatewayEnrollEvent {
};
}
+type ResourceAuthMethodKind = "aws" | "token";
+
+interface ResourceAuthMethodLoginEvent {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN;
+ metadata: {
+ resourceType: "gateway";
+ resourceId: string;
+ method: ResourceAuthMethodKind;
+ methodConfigId: string;
+ principalArn?: string;
+ accountId?: string;
+ enrollmentTokenId?: string;
+ };
+}
+
+interface ResourceAuthMethodLoginFailedEvent {
+ type: EventType.RESOURCE_AUTH_METHOD_LOGIN_FAILED;
+ metadata: {
+ resourceType: "gateway";
+ resourceId: string;
+ method: ResourceAuthMethodKind;
+ reasonCode: string;
+ message: string;
+ principalArn?: string;
+ accountId?: string;
+ };
+}
+
+interface ResourceAuthMethodUpdateEvent {
+ type: EventType.RESOURCE_AUTH_METHOD_UPDATE;
+ metadata: {
+ resourceType: "gateway";
+ resourceId: string;
+ method: ResourceAuthMethodKind;
+ methodConfigId: string;
+ stsEndpoint?: string;
+ allowedPrincipalArns?: string;
+ allowedAccountIds?: string;
+ };
+}
+
+interface ResourceAuthMethodRevokeEvent {
+ type: EventType.RESOURCE_AUTH_METHOD_REVOKE;
+ metadata: {
+ resourceType: "gateway";
+ resourceId: string;
+ method: ResourceAuthMethodKind;
+ gatewayName: string;
+ deletedTokenCount: number;
+ };
+}
+
interface GatewayPoolCreateEvent {
type: EventType.GATEWAY_POOL_CREATE;
metadata: {
@@ -6878,6 +6936,10 @@ export type Event =
| GatewayCreateEvent
| GatewayEnrollmentTokenCreateEvent
| GatewayEnrollEvent
+ | ResourceAuthMethodLoginEvent
+ | ResourceAuthMethodLoginFailedEvent
+ | ResourceAuthMethodUpdateEvent
+ | ResourceAuthMethodRevokeEvent
| GatewayPoolCreateEvent
| GatewayPoolUpdateEvent
| GatewayPoolDeleteEvent
diff --git a/backend/src/ee/services/gateway-v2/gateway-enrollment-token-dal.ts b/backend/src/ee/services/gateway-v2/gateway-enrollment-token-dal.ts
deleted file mode 100644
index 18bbecc451..0000000000
--- a/backend/src/ee/services/gateway-v2/gateway-enrollment-token-dal.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { TDbClient } from "@app/db";
-import { TableName } from "@app/db/schemas";
-import { ormify } from "@app/lib/knex";
-
-export type TGatewayEnrollmentTokenDALFactory = ReturnType<typeof gatewayEnrollmentTokenDALFactory>;
-
-export const gatewayEnrollmentTokenDALFactory = (db: TDbClient) => {
- return ormify(db, TableName.GatewayEnrollmentTokens);
-};
diff --git a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
index ed2d525d14..e4cfa68aad 100644
--- a/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
+++ b/backend/src/ee/services/gateway-v2/gateway-v2-service.ts
@@ -3,9 +3,8 @@ import net from "node:net";
import { ForbiddenError } from "@casl/ability";
import * as x509 from "@peculiar/x509";
-import { OrganizationActionScope, OrgMembershipRole, OrgMembershipStatus, TableName, TRelays } from "@app/db/schemas";
+import { OrganizationActionScope, OrgMembershipRole, OrgMembershipStatus, TRelays } from "@app/db/schemas";
import { PgSqlLock } from "@app/keystore/keystore";
-import { getConfig } from "@app/lib/config/env";
import { crypto } from "@app/lib/crypto";
import { DatabaseErrorCode } from "@app/lib/error-codes";
import { BadRequestError, DatabaseError, NotFoundError } from "@app/lib/errors";
@@ -15,7 +14,7 @@ import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";
import { logger } from "@app/lib/logger";
import { OrgServiceActor } from "@app/lib/types";
import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
-import { ActorAuthMethod, ActorType, AuthTokenType } from "@app/services/auth/auth-type";
+import { ActorAuthMethod, ActorType } from "@app/services/auth/auth-type";
import { constructPemChainFromCerts } from "@app/services/certificate/certificate-fns";
import { CertExtendedKeyUsage, CertKeyAlgorithm, CertKeyUsage } from "@app/services/certificate/certificate-types";
import {
@@ -40,7 +39,8 @@ import { TPermissionServiceFactory } from "../permission/permission-service-type
import { TPkiDiscoveryConfigDALFactory } from "../pki-discovery/pki-discovery-config-dal";
import { TRelayDALFactory } from "../relay/relay-dal";
import { TRelayServiceFactory } from "../relay/relay-service";
-import { TGatewayEnrollmentTokenDALFactory } from "./gateway-enrollment-token-dal";
+import { TResourceAuthMethodServiceFactory } from "../resource-auth-method/resource-auth-method-service";
+import { TAwsAuthMethodConfig } from "../resource-auth-method/resource-auth-method-types";
import { GATEWAY_ACTOR_OID, GATEWAY_ROUTING_INFO_OID, PAM_INFO_OID } from "./gateway-v2-constants";
import { TGatewayV2DALFactory } from "./gateway-v2-dal";
import { GatewayHealthCheckStatus, TGatewayV2ConnectionDetails } from "./gateway-v2-types";
@@ -54,7 +54,6 @@ type TGatewayV2ServiceFactoryDep = {
kmsService: TKmsServiceFactory;
relayService: TRelayServiceFactory;
gatewayV2DAL: TGatewayV2DALFactory;
- gatewayEnrollmentTokenDAL: TGatewayEnrollmentTokenDALFactory;
relayDAL: TRelayDALFactory;
permissionService: TPermissionServiceFactory;
orgDAL: Pick<TOrgDALFactory, "findOrgMembersByRole">;
@@ -67,6 +66,10 @@ type TGatewayV2ServiceFactoryDep = {
identityKubernetesAuthDAL: Pick<TIdentityKubernetesAuthDALFactory, "findByGatewayId" | "countByGatewayId">;
aiMcpServerDAL: Pick<TAiMcpServerDALFactory, "findByGatewayId" | "countByGatewayId">;
pkiDiscoveryConfigDAL: Pick<TPkiDiscoveryConfigDALFactory, "findByGatewayId" | "countByGatewayId">;
+ resourceAuthMethodService: Pick<
+ TResourceAuthMethodServiceFactory,
+ "initAtCreate" | "loadView" | "mintToken" | "loginWithToken"
+ >;
};
export type TGatewayV2ServiceFactory = ReturnType<typeof gatewayV2ServiceFactory>;
@@ -76,7 +79,6 @@ export const gatewayV2ServiceFactory = ({
kmsService,
relayService,
gatewayV2DAL,
- gatewayEnrollmentTokenDAL,
relayDAL,
permissionService,
orgDAL,
@@ -87,17 +89,9 @@ export const gatewayV2ServiceFactory = ({
pamDiscoverySourceDAL,
identityKubernetesAuthDAL,
aiMcpServerDAL,
- pkiDiscoveryConfigDAL
+ pkiDiscoveryConfigDAL,
+ resourceAuthMethodService
}: TGatewayV2ServiceFactoryDep) => {
- const ENROLLMENT_TOKEN_TTL_SECONDS = 3600;
-
- const $generateEnrollmentToken = () => {
- const plainToken = `gwe_${crypto.randomBytes(32).toString("base64url")}`;
- const tokenHash = crypto.nativeCrypto.createHash("sha256").update(plainToken).digest("hex");
- const expiresAt = new Date(Date.now() + ENROLLMENT_TOKEN_TTL_SECONDS * 1000);
- return { plainToken, tokenHash, expiresAt };
- };
-
const $validateIdentityAccessToGateway = async (orgId: string, actorId: string, actorAuthMethod: ActorAuthMethod) => {
const { permission } = await permissionService.getOrgPermission({
scope: OrganizationActionScope.Any,
@@ -353,27 +347,9 @@ export const gatewayV2ServiceFactory = ({
countMap.set(id, (countMap.get(id) ?? 0) + count);
}
- // Check enrollment token status for each gateway
- const allTokens = await gatewayEnrollmentTokenDAL.find({ orgId: orgPermission.orgId });
- const now = new Date();
- const tokenStatusMap = new Map<string, "pending" | "expired">();
- for (const token of allTokens) {
- if (!token.usedAt && token.gatewayId) {
- const isExpired = token.expiresAt <= now;
- const current = tokenStatusMap.get(token.gatewayId);
- // A non-expired token takes priority over an expired one
- if (!isExpired) {
- tokenStatusMap.set(token.gatewayId, "pending");
- } else if (!current) {
- tokenStatusMap.set(token.gatewayId, "expired");
- }
- }
- }
-
return gateways.map((gateway) => ({
...gateway,
- connectedResourcesCount: countMap.get(gateway.id) ?? 0,
- enrollmentTokenStatus: tokenStatusMap.get(gateway.id) ?? null
+ connectedResourcesCount: countMap.get(gateway.id) ?? 0
}));
};
@@ -829,17 +805,22 @@ export const gatewayV2ServiceFactory = ({
if (!relay) throw new NotFoundError({ message: `Relay ${relayName} not found` });
try {
- const [gateway] = await gatewayV2DAL.upsert(
- [
- {
- orgId,
- name,
- identityId: actorId,
- relayId: relay.id
- }
- ],
- ["identityId"]
- );
+ const gateway = await gatewayV2DAL.transaction(async (tx) => {
+ const [upserted] = await gatewayV2DAL.upsert(
+ [
+ {
+ orgId,
+ name,
+ identityId: actorId,
+ relayId: relay.id
+ }
+ ],
+ ["identityId"],
+ tx
+ );
+
+ return upserted;
+ });
return await $issueGatewayCerts({ orgId, orgCAs, relayName, gateway });
} catch (err) {
@@ -1204,13 +1185,15 @@ export const gatewayV2ServiceFactory = ({
actorId,
actorType,
actorAuthMethod,
- name
+ name,
+ authMethod
}: {
orgId: string;
actorId: string;
actorType: ActorType;
actorAuthMethod: ActorAuthMethod;
name: string;
+ authMethod: { method: "aws"; config: TAwsAuthMethodConfig } | { method: "token" };
}) => {
const { permission } = await permissionService.getOrgPermission({
actor: actorType,
@@ -1238,8 +1221,9 @@ export const gatewayV2ServiceFactory = ({
});
}
+ let created;
try {
- return await gatewayV2DAL.create({ orgId, name }, tx);
+ created = await gatewayV2DAL.create({ orgId, name }, tx);
} catch (err) {
if (
err instanceof DatabaseError &&
@@ -1249,64 +1233,13 @@ export const gatewayV2ServiceFactory = ({
}
throw err;
}
- });
- return gateway;
- };
+ await resourceAuthMethodService.initAtCreate({ gatewayId: created.id, authMethod }, tx);
- const configureTokenAuth = async ({
- orgPermission,
- gatewayId
- }: {
- orgPermission: OrgServiceActor;
- gatewayId: string;
- }) => {
- const { permission } = await permissionService.getOrgPermission({
- actor: orgPermission.type,
- actorId: orgPermission.id,
- orgId: orgPermission.orgId,
- actorAuthMethod: orgPermission.authMethod,
- actorOrgId: orgPermission.orgId,
- scope: OrganizationActionScope.Any
+ return created;
});
- ForbiddenError.from(permission).throwUnlessCan(
- OrgPermissionGatewayActions.EditGateways,
- OrgPermissionSubjects.Gateway
- );
-
- const gateway = await gatewayV2DAL.findById(gatewayId);
- if (!gateway || gateway.orgId !== orgPermission.orgId) {
- throw new NotFoundError({ message: `Gateway ${gatewayId} not found` });
- }
-
- if (gateway.identityId) {
- throw new BadRequestError({ message: "Cannot configure token auth for identity-based gateways" });
- }
-
- const gatewayToken = $generateEnrollmentToken();
-
- const record = await gatewayEnrollmentTokenDAL.transaction(async (tx) => {
- // Delete any existing unused enrollment tokens for this gateway
- const existingTokens = await gatewayEnrollmentTokenDAL.find({ gatewayId }, { tx });
- const unusedTokenIds = existingTokens.filter((t) => !t.usedAt).map((t) => t.id);
- if (unusedTokenIds.length > 0) {
- await gatewayEnrollmentTokenDAL.delete({ $in: { id: unusedTokenIds } }, tx);
- }
-
- return gatewayEnrollmentTokenDAL.create(
- {
- orgId: orgPermission.orgId,
- tokenHash: gatewayToken.tokenHash,
- ttl: ENROLLMENT_TOKEN_TTL_SECONDS,
- expiresAt: gatewayToken.expiresAt,
- gatewayId
- },
- tx
- );
- });
-
- return { ...record, token: gatewayToken.plainToken, gatewayName: gateway.name };
+ return gateway;
};
const connectGateway = async ({
@@ -1351,60 +1284,7 @@ export const gatewayV2ServiceFactory = ({
};
const enrollGateway = async ({ token }: { token: string }) => {
- const tokenHash = crypto.nativeCrypto.createHash("sha256").update(token).digest("hex");
-
- const tokenRecord = await gatewayEnrollmentTokenDAL.findOne({ tokenHash });
- if (!tokenRecord) {
- throw new BadRequestError({ message: "Invalid enrollment token" });
- }
-
- if (tokenRecord.expiresAt < new Date()) {
- throw new BadRequestError({ message: "Enrollment token has expired" });
- }
-
- if (!tokenRecord.gatewayId) {
- throw new BadRequestError({ message: "Enrollment token is not linked to a gateway" });
- }
-
- const { orgId } = tokenRecord;
-
- // Consume the token and bump tokenVersion in a single transaction.
- const gateway = await gatewayEnrollmentTokenDAL.transaction(async (tx) => {
- const rows = await tx(TableName.GatewayEnrollmentTokens)
- .where({ id: tokenRecord.id })
- .whereNull("usedAt")
- .update({ usedAt: new Date() })
- .returning("*");
- if (rows.length === 0) {
- throw new BadRequestError({ message: "Enrollment token has already been used" });
- }
-
- const existing = await gatewayV2DAL.findById(tokenRecord.gatewayId!, tx);
- if (!existing) throw new NotFoundError({ message: `Gateway ${tokenRecord.gatewayId} not found` });
- return gatewayV2DAL.updateById(
- existing.id,
- { $incr: { tokenVersion: 1 }, heartbeat: null, lastHealthCheckStatus: null },
- tx
- );
- });
-
- const appCfg = getConfig();
- const accessToken = crypto.jwt().sign(
- {
- gatewayId: gateway.id,
- orgId,
- authTokenType: AuthTokenType.GATEWAY_ACCESS_TOKEN,
- tokenVersion: gateway.tokenVersion
- },
- appCfg.AUTH_SECRET
- );
-
- return {
- accessToken,
- gatewayId: gateway.id,
- gatewayName: gateway.name,
- orgId
- };
+ return resourceAuthMethodService.loginWithToken({ token });
};
return {
@@ -1422,7 +1302,6 @@ export const gatewayV2ServiceFactory = ({
enrollGateway,
// V3
createGateway,
- configureTokenAuth,
connectGateway
};
};
diff --git a/backend/src/ee/services/permission/org-permission.ts b/backend/src/ee/services/permission/org-permission.ts
index b28bc990c7..8cabd2a545 100644
--- a/backend/src/ee/services/permission/org-permission.ts
+++ b/backend/src/ee/services/permission/org-permission.ts
@@ -71,7 +71,8 @@ export enum OrgPermissionGatewayActions {
ListGateways = "list-gateways",
EditGateways = "edit-gateways",
DeleteGateways = "delete-gateways",
- AttachGateways = "attach-gateways"
+ AttachGateways = "attach-gateways",
+ RevokeGatewayAccess = "revoke-gateway-access"
}
export enum OrgPermissionGatewayPoolActions {
@@ -471,6 +472,7 @@ const buildAdminPermission = () => {
can(OrgPermissionGatewayActions.EditGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.DeleteGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.AttachGateways, OrgPermissionSubjects.Gateway);
+ can(OrgPermissionGatewayActions.RevokeGatewayAccess, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayPoolActions.ListGatewayPools, OrgPermissionSubjects.GatewayPool);
can(OrgPermissionGatewayPoolActions.CreateGatewayPools, OrgPermissionSubjects.GatewayPool);
diff --git a/backend/src/ee/services/resource-auth-method/aws-auth-dal.ts b/backend/src/ee/services/resource-auth-method/aws-auth-dal.ts
new file mode 100644
index 0000000000..7aa2d861ca
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/aws-auth-dal.ts
@@ -0,0 +1,9 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TResourceAwsAuthDALFactory = ReturnType<typeof resourceAwsAuthDALFactory>;
+
+export const resourceAwsAuthDALFactory = (db: TDbClient) => {
+ return ormify(db, TableName.ResourceAwsAuth);
+};
diff --git a/backend/src/ee/services/resource-auth-method/aws-auth-fns.ts b/backend/src/ee/services/resource-auth-method/aws-auth-fns.ts
new file mode 100644
index 0000000000..a5259c7761
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/aws-auth-fns.ts
@@ -0,0 +1,173 @@
+import RE2 from "re2";
+
+import { request } from "@app/lib/config/request";
+import { UnauthorizedError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { extractPrincipalArn } from "@app/services/identity-aws-auth/identity-aws-auth-fns";
+
+import { TAwsGetCallerIdentityHeaders, TGetCallerIdentityResponse } from "./aws-auth-types";
+
+// Parses the AWS region from the SigV4 Authorization header's Credential=… segment.
+// Same approach as identity-aws-auth (services/identity-aws-auth/identity-aws-auth-service.ts).
+// We trust the caller-provided region because the signature itself is bound to it; if the
+// region is wrong, AWS STS will reject the proxied request.
+const awsRegionFromHeader = (authorizationHeader: string): string | null => {
+ // Authorization: AWS4-HMAC-SHA256 Credential=AKIA.../<date>/<region>/sts/aws4_request, ...
+ try {
+ const fields = authorizationHeader.split(" ");
+ for (const field of fields) {
+ if (field.startsWith("Credential=")) {
+ const parts = field.split("/");
+ if (parts.length >= 3) return parts[2];
+ }
+ }
+ } catch {
+ return null;
+ }
+ return null;
+};
+
+const validRegionPattern = new RE2("^[a-z0-9-]+$");
+
+const isValidAwsRegion = (region: string | null): boolean => {
+ if (typeof region !== "string" || region.length === 0 || region.length > 20) return false;
+ return validRegionPattern.test(region);
+};
+
+type TVerifyStsCallerInput = {
+ iamHttpRequestMethod: string;
+ iamRequestBody: string;
+ iamRequestHeaders: string;
+ defaultStsEndpoint: string;
+ errorContext: { gatewayId: string; orgId: string; gatewayName: string };
+};
+
+/**
+ * Verifies a signed STS GetCallerIdentity request and returns the caller's account/ARN/userId.
+ * Throws UnauthorizedError on failure with errorContext attached so callers can audit-log it.
+ */
+export const verifyStsAndExtractCaller = async ({
+ iamHttpRequestMethod,
+ iamRequestBody,
+ iamRequestHeaders,
+ defaultStsEndpoint,
+ errorContext
+}: TVerifyStsCallerInput) => {
+ let headers: TAwsGetCallerIdentityHeaders;
+ let body: string;
+ try {
+ headers = JSON.parse(Buffer.from(iamRequestHeaders, "base64").toString()) as TAwsGetCallerIdentityHeaders;
+ body = Buffer.from(iamRequestBody, "base64").toString();
+ } catch {
+ throw new UnauthorizedError({
+ message: "Malformed signed STS request",
+ detail: { reasonCode: "malformed_request", ...errorContext }
+ });
+ }
+
+ const authHeader = headers.Authorization || headers.authorization;
+ const region = authHeader ? awsRegionFromHeader(authHeader) : null;
+
+ if (!isValidAwsRegion(region)) {
+ throw new UnauthorizedError({
+ message: "Invalid AWS region",
+ detail: { reasonCode: "invalid_region", ...errorContext }
+ });
+ }
+
+ const url = region ? `https://sts.${region}.amazonaws.com` : defaultStsEndpoint;
+
+ let stsResponse: { data: TGetCallerIdentityResponse };
+ try {
+ stsResponse = await request({
+ method: iamHttpRequestMethod,
+ url,
+ headers,
+ data: body
+ });
+ } catch (err) {
+ logger.error(err, `Resource AWS Auth Login: STS verification failed [gateway-id=${errorContext.gatewayId}]`);
+ throw new UnauthorizedError({
+ message: "STS verification failed",
+ detail: { reasonCode: "sts_request_failed", ...errorContext }
+ });
+ }
+
+ const {
+ GetCallerIdentityResponse: {
+ GetCallerIdentityResult: { Account, Arn, UserId }
+ }
+ } = stsResponse.data;
+
+ return { Account, Arn, UserId };
+};
+
+type TValidateAllowlistsInput = {
+ Account: string;
+ Arn: string;
+ allowedAccountIds: string;
+ allowedPrincipalArns: string;
+ errorContext: { gatewayId: string; orgId: string; gatewayName: string };
+};
+
+export const validateAllowlists = ({
+ Account,
+ Arn,
+ allowedAccountIds,
+ allowedPrincipalArns,
+ errorContext
+}: TValidateAllowlistsInput) => {
+ // Defense-in-depth: route-layer schema requires at least one allowlist field, but the
+ // service is also reachable from create flows / future internal callers. Refuse to
+ // authenticate against an unrestricted config rather than silently allowing any caller.
+ if (!allowedAccountIds?.trim() && !allowedPrincipalArns?.trim()) {
+ throw new UnauthorizedError({
+ message: "Access denied: AWS auth method has no allowlist configured.",
+ detail: { reasonCode: "no_allowlist_configured", ...errorContext }
+ });
+ }
+
+ if (allowedAccountIds) {
+ const isAccountAllowed = allowedAccountIds
+ .split(",")
+ .map((accountId) => accountId.trim())
+ .filter((accountId) => accountId.length > 0)
+ .some((accountId) => accountId === Account);
+
+ if (!isAccountAllowed) {
+ throw new UnauthorizedError({
+ message: "Access denied: AWS account ID not allowed.",
+ detail: { reasonCode: "account_id_not_allowed", accountId: Account, principalArn: Arn, ...errorContext }
+ });
+ }
+ }
+
+ if (allowedPrincipalArns) {
+ const formattedArn = extractPrincipalArn(Arn);
+
+ const isArnAllowed = allowedPrincipalArns
+ .split(",")
+ .map((principalArn) => principalArn.trim())
+ .filter((principalArn) => principalArn.length > 0)
+ .some((principalArn) => {
+ // Convert wildcard to regex; arnRegex in validators ensures safe input.
+ const regex = new RE2(`^${principalArn.replaceAll("*", ".*")}$`);
+ return regex.test(formattedArn) || regex.test(extractPrincipalArn(Arn, true));
+ });
+
+ if (!isArnAllowed) {
+ logger.error(
+ `Resource AWS Auth Login: AWS principal ARN not allowed [principal-arn=${formattedArn}] [raw-arn=${Arn}] [gateway-id=${errorContext.gatewayId}]`
+ );
+ throw new UnauthorizedError({
+ message: `Access denied: AWS principal ARN not allowed. [principal-arn=${formattedArn}]`,
+ detail: {
+ reasonCode: "principal_arn_not_allowed",
+ accountId: Account,
+ principalArn: formattedArn,
+ ...errorContext
+ }
+ });
+ }
+ }
+};
diff --git a/backend/src/ee/services/resource-auth-method/aws-auth-types.ts b/backend/src/ee/services/resource-auth-method/aws-auth-types.ts
new file mode 100644
index 0000000000..ab591ea22b
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/aws-auth-types.ts
@@ -0,0 +1,20 @@
+export type TAwsGetCallerIdentityHeaders = {
+ "Content-Type": string;
+ Host: string;
+ "X-Amz-Date": string;
+ "Content-Length": number;
+ "x-amz-security-token": string;
+ Authorization: string;
+ authorization?: string;
+};
+
+export type TGetCallerIdentityResponse = {
+ GetCallerIdentityResponse: {
+ GetCallerIdentityResult: {
+ Account: string;
+ Arn: string;
+ UserId: string;
+ };
+ ResponseMetadata: { RequestId: string };
+ };
+};
diff --git a/backend/src/ee/services/resource-auth-method/aws-auth-validators.ts b/backend/src/ee/services/resource-auth-method/aws-auth-validators.ts
new file mode 100644
index 0000000000..b923e5d8cd
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/aws-auth-validators.ts
@@ -0,0 +1,4 @@
+export {
+ validateAccountIds,
+ validatePrincipalArns
+} from "@app/services/identity-aws-auth/identity-aws-auth-validators";
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-dal.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-dal.ts
new file mode 100644
index 0000000000..15a400a7a2
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-dal.ts
@@ -0,0 +1,9 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TResourceAuthMethodDALFactory = ReturnType<typeof resourceAuthMethodDALFactory>;
+
+export const resourceAuthMethodDALFactory = (db: TDbClient) => {
+ return ormify(db, TableName.ResourceAuthMethod);
+};
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts
new file mode 100644
index 0000000000..ade02f63fa
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-fns.ts
@@ -0,0 +1,68 @@
+import { getConfig } from "@app/lib/config/env";
+import { crypto } from "@app/lib/crypto";
+import { BadRequestError } from "@app/lib/errors";
+import { AuthTokenType } from "@app/services/auth/auth-type";
+
+/**
+ * Mints a GATEWAY_ACCESS_TOKEN JWT for a gateway. Same payload shape that the legacy
+ * enrollment-token flow produced — kept identical so issued tokens are indistinguishable
+ * regardless of which auth method produced them.
+ */
+export const mintGatewayJwt = ({
+ gatewayId,
+ orgId,
+ tokenVersion,
+ accessTokenTTL
+}: {
+ gatewayId: string;
+ orgId: string;
+ tokenVersion: number;
+ accessTokenTTL: number;
+}) => {
+ const appCfg = getConfig();
+ return crypto.jwt().sign(
+ {
+ gatewayId,
+ orgId,
+ authTokenType: AuthTokenType.GATEWAY_ACCESS_TOKEN,
+ tokenVersion
+ },
+ appCfg.AUTH_SECRET,
+ accessTokenTTL === 0 ? undefined : { expiresIn: accessTokenTTL }
+ );
+};
+
+// ResourceRef.type is "gateway" only today; the abstraction is in place so relay can be
+// added additively in a follow-up PR without renaming routes, audit events
+// ("RESOURCE_AUTH_METHOD_*"), or DB tables (resource_auth_methods, resource_aws_auths).
+export type ResourceRef = { type: "gateway"; id: string };
+
+export const RESOURCE_TYPE_GATEWAY = "gateway" as const;
+
+// Accepts a wider input than ResourceRef so the runtime guard remains a meaningful check
+// (today TS narrows ResourceRef.type to "gateway" at compile time, but this function exists
+// so the runtime layer is ready when more resource types are added).
+export const assertGatewayResource = (resource: { type: string }, methodName: string) => {
+ if (resource.type !== RESOURCE_TYPE_GATEWAY) {
+ throw new BadRequestError({
+ message: `Resource type "${resource.type}" not supported for ${methodName} auth`
+ });
+ }
+};
+
+// All auth method values surfaced anywhere in the system.
+//
+// - 'aws' / 'token' — stored in resource_auth_methods.method, settable via the API.
+// - 'identity' — legacy state, derived from gateways_v2.identityId. Returned in
+// the API view but never stored in the registry and never
+// accepted as input to set/mint operations. The "settable" subset
+// is enforced by the discriminated TSetAuthMethodInput type
+// (which only accepts aws/token), not by this enum-like const.
+export const ResourceAuthMethodType = {
+ Aws: "aws",
+ Token: "token",
+ Identity: "identity"
+} as const;
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export type ResourceAuthMethodType = (typeof ResourceAuthMethodType)[keyof typeof ResourceAuthMethodType];
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
new file mode 100644
index 0000000000..9b61f86016
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-service.ts
@@ -0,0 +1,468 @@
+import { ForbiddenError } from "@casl/ability";
+import { Knex } from "knex";
+
+import { OrganizationActionScope } from "@app/db/schemas";
+import { crypto } from "@app/lib/crypto";
+import { BadRequestError, NotFoundError, UnauthorizedError } from "@app/lib/errors";
+import { TIdentityDALFactory } from "@app/services/identity/identity-dal";
+
+import { TGatewayV2DALFactory } from "../gateway-v2/gateway-v2-dal";
+import { OrgPermissionGatewayActions, OrgPermissionSubjects } from "../permission/org-permission";
+import { TPermissionServiceFactory } from "../permission/permission-service-types";
+import { TResourceAwsAuthDALFactory } from "./aws-auth-dal";
+import { validateAllowlists, verifyStsAndExtractCaller } from "./aws-auth-fns";
+import { TResourceAuthMethodDALFactory } from "./resource-auth-method-dal";
+import { assertGatewayResource, mintGatewayJwt, ResourceAuthMethodType } from "./resource-auth-method-fns";
+import {
+ TAuthMethodView,
+ TAwsAuthMethodConfig,
+ TGetAuthMethodDTO,
+ TLoginWithAwsDTO,
+ TLoginWithTokenDTO,
+ TMintTokenDTO,
+ TRevokeTokenDTO,
+ TSetAuthMethodDTO
+} from "./resource-auth-method-types";
+import { TResourceTokenAuthDALFactory } from "./token-auth-dal";
+
+const ENROLLMENT_TOKEN_TTL_SECONDS = 3600;
+
+const $generateEnrollmentToken = () => {
+ const plainToken = `gwe_${crypto.randomBytes(32).toString("base64url")}`;
+ const tokenHash = crypto.nativeCrypto.createHash("sha256").update(plainToken).digest("hex");
+ const expiresAt = new Date(Date.now() + ENROLLMENT_TOKEN_TTL_SECONDS * 1000);
+ return { plainToken, tokenHash, expiresAt };
+};
+
+type TResourceAuthMethodServiceFactoryDep = {
+ resourceAuthMethodDAL: TResourceAuthMethodDALFactory;
+ resourceAwsAuthDAL: TResourceAwsAuthDALFactory;
+ resourceTokenAuthDAL: TResourceTokenAuthDALFactory;
+ gatewayV2DAL: Pick<TGatewayV2DALFactory, "findById" | "updateById">;
+ identityDAL: Pick<TIdentityDALFactory, "findById">;
+ permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;
+};
+
+export type TResourceAuthMethodServiceFactory = ReturnType<typeof resourceAuthMethodServiceFactory>;
+
+export const resourceAuthMethodServiceFactory = ({
+ resourceAuthMethodDAL,
+ resourceAwsAuthDAL,
+ resourceTokenAuthDAL,
+ gatewayV2DAL,
+ identityDAL,
+ permissionService
+}: TResourceAuthMethodServiceFactoryDep) => {
+ const $checkPermission = async (actor: TSetAuthMethodDTO["actor"], action: OrgPermissionGatewayActions) => {
+ const { permission } = await permissionService.getOrgPermission({
+ scope: OrganizationActionScope.Any,
+ actor: actor.type,
+ actorId: actor.id,
+ orgId: actor.orgId,
+ actorAuthMethod: actor.authMethod,
+ actorOrgId: actor.orgId
+ });
+ ForbiddenError.from(permission).throwUnlessCan(action, OrgPermissionSubjects.Gateway);
+ };
+
+ // Identity is checked first via gateways_v2.identityId — it's the authoritative
+ // legacy-state signal and overrides any registry row.
+ const $loadAuthMethodView = async (gatewayId: string): Promise<TAuthMethodView | null> => {
+ const gateway = await gatewayV2DAL.findById(gatewayId);
+ if (!gateway) return null;
+
+ if (gateway.identityId) {
+ const identity = await identityDAL.findById(gateway.identityId);
+ return {
+ method: ResourceAuthMethodType.Identity,
+ config: {
+ identityId: gateway.identityId,
+ identityName: identity?.name ?? null
+ }
+ };
+ }
+
+ const registry = await resourceAuthMethodDAL.findOne({ gatewayId });
+ if (!registry) return null;
+
+ if (registry.method === ResourceAuthMethodType.Aws) {
+ const config = await resourceAwsAuthDAL.findOne({ authMethodId: registry.id });
+ if (!config) {
+ throw new NotFoundError({ message: "AWS auth config missing for gateway" });
+ }
+ return {
+ method: ResourceAuthMethodType.Aws,
+ config: {
+ id: config.id,
+ stsEndpoint: config.stsEndpoint,
+ allowedPrincipalArns: config.allowedPrincipalArns,
+ allowedAccountIds: config.allowedAccountIds,
+ createdAt: config.createdAt,
+ updatedAt: config.updatedAt
+ }
+ };
+ }
+
+ if (registry.method === ResourceAuthMethodType.Token) {
+ return {
+ method: ResourceAuthMethodType.Token,
+ config: {}
+ };
+ }
+
+ throw new BadRequestError({ message: `Unknown auth method "${registry.method}"` });
+ };
+
+ const getByGatewayId = async ({ resource, actor }: TGetAuthMethodDTO) => {
+ assertGatewayResource(resource, "auth-method");
+ await $checkPermission(actor, OrgPermissionGatewayActions.ListGateways);
+
+ const gateway = await gatewayV2DAL.findById(resource.id);
+ if (!gateway || gateway.orgId !== actor.orgId) {
+ throw new NotFoundError({ message: `Gateway ${resource.id} not found` });
+ }
+
+ const view = await $loadAuthMethodView(resource.id);
+ if (!view) {
+ throw new NotFoundError({ message: "Gateway has no auth method configured" });
+ }
+ return view;
+ };
+
+ const loadView = async (gatewayId: string): Promise<TAuthMethodView | null> => $loadAuthMethodView(gatewayId);
+
+ // Revoke is meaningful when there's something to invalidate: an active JWT
+ // (tokenVersion > 0) or a pending unused enrollment-token row.
+ const canRevoke = async (gateway: { id: string; tokenVersion: number; identityId?: string | null }) => {
+ if (gateway.identityId) return false;
+ if (gateway.tokenVersion > 0) return true;
+ const registry = await resourceAuthMethodDAL.findOne({ gatewayId: gateway.id });
+ if (!registry || registry.method !== ResourceAuthMethodType.Token) return false;
+ const pending = await resourceTokenAuthDAL.findOne({ authMethodId: registry.id });
+ return Boolean(pending);
+ };
+
+ const initAtCreate = async (
+ {
+ gatewayId,
+ authMethod
+ }: {
+ gatewayId: string;
+ authMethod:
+ | { method: typeof ResourceAuthMethodType.Aws; config: TAwsAuthMethodConfig }
+ | { method: typeof ResourceAuthMethodType.Token };
+ },
+ tx: Knex
+ ) => {
+ const registry = await resourceAuthMethodDAL.create({ gatewayId, method: authMethod.method }, tx);
+ if (authMethod.method === ResourceAuthMethodType.Aws) {
+ await resourceAwsAuthDAL.create(
+ {
+ authMethodId: registry.id,
+ stsEndpoint: authMethod.config.stsEndpoint,
+ allowedPrincipalArns: authMethod.config.allowedPrincipalArns,
+ allowedAccountIds: authMethod.config.allowedAccountIds
+ },
+ tx
+ );
+ }
+ };
+
+ // tokenVersion is intentionally NOT bumped on method change — running gateways keep
+ // their JWT until the next restart, avoiding forced downtime. Use revoke for that.
+ const setMethod = async ({ resource, authMethod, actor }: TSetAuthMethodDTO): Promise<TAuthMethodView> => {
+ assertGatewayResource(resource, "auth-method");
+ await $checkPermission(actor, OrgPermissionGatewayActions.EditGateways);
+
+ const gateway = await gatewayV2DAL.findById(resource.id);
+ if (!gateway || gateway.orgId !== actor.orgId) {
+ throw new NotFoundError({ message: `Gateway ${resource.id} not found` });
+ }
+
+ if (gateway.identityId) {
+ throw new BadRequestError({
+ message:
+ "This gateway is using legacy machine identity auth. Create a new gateway with the desired auth method instead of migrating this one."
+ });
+ }
+
+ const current = await resourceAuthMethodDAL.findOne({ gatewayId: resource.id });
+ const previousMethod = current?.method ?? null;
+
+ await resourceAuthMethodDAL.transaction(async (tx) => {
+ // 1. Upsert registry row to the new method.
+ let registryRow = current;
+ if (current) {
+ registryRow = await resourceAuthMethodDAL.updateById(current.id, { method: authMethod.method }, tx);
+ } else {
+ registryRow = await resourceAuthMethodDAL.create({ gatewayId: resource.id, method: authMethod.method }, tx);
+ }
+
+ // 2. Drop the previous method's config artifacts.
+ if (
+ previousMethod === ResourceAuthMethodType.Aws &&
+ authMethod.method !== ResourceAuthMethodType.Aws &&
+ current
+ ) {
+ await resourceAwsAuthDAL.delete({ authMethodId: current.id }, tx);
+ }
+ if (
+ previousMethod === ResourceAuthMethodType.Token &&
+ authMethod.method !== ResourceAuthMethodType.Token &&
+ current
+ ) {
+ await resourceTokenAuthDAL.delete({ authMethodId: current.id }, tx);
+ }
+
+ // 3. Insert/upsert the new method's config row.
+ if (authMethod.method === ResourceAuthMethodType.Aws) {
+ const existingAws = await resourceAwsAuthDAL.findOne({ authMethodId: registryRow.id }, tx);
+ if (existingAws) {
+ await resourceAwsAuthDAL.updateById(
+ existingAws.id,
+ {
+ stsEndpoint: authMethod.stsEndpoint,
+ allowedPrincipalArns: authMethod.allowedPrincipalArns,
+ allowedAccountIds: authMethod.allowedAccountIds
+ },
+ tx
+ );
+ } else {
+ await resourceAwsAuthDAL.create(
+ {
+ authMethodId: registryRow.id,
+ stsEndpoint: authMethod.stsEndpoint,
+ allowedPrincipalArns: authMethod.allowedPrincipalArns,
+ allowedAccountIds: authMethod.allowedAccountIds
+ },
+ tx
+ );
+ }
+ }
+ });
+
+ const view = await $loadAuthMethodView(resource.id);
+ if (!view) {
+ throw new NotFoundError({ message: "Auth method not found after set" });
+ }
+ return view;
+ };
+
+ // Non-destructive: minting a new token does NOT bump tokenVersion or clear heartbeat,
+ // so a running gateway keeps working. The next login (with the new token) does the bump.
+ const mintToken = async ({ resource, actor }: TMintTokenDTO) => {
+ assertGatewayResource(resource, "token");
+ await $checkPermission(actor, OrgPermissionGatewayActions.EditGateways);
+
+ const gateway = await gatewayV2DAL.findById(resource.id);
+ if (!gateway || gateway.orgId !== actor.orgId) {
+ throw new NotFoundError({ message: `Gateway ${resource.id} not found` });
+ }
+
+ const registry = await resourceAuthMethodDAL.findOne({ gatewayId: resource.id });
+ if (!registry || registry.method !== ResourceAuthMethodType.Token) {
+ throw new BadRequestError({
+ message: `Gateway is not configured for token authentication (current method: ${registry?.method ?? "none"})`
+ });
+ }
+
+ const generated = $generateEnrollmentToken();
+
+ const record = await resourceTokenAuthDAL.transaction(async (tx) => {
+ await resourceTokenAuthDAL.delete({ authMethodId: registry.id }, tx);
+ return resourceTokenAuthDAL.create(
+ {
+ orgId: actor.orgId,
+ tokenHash: generated.tokenHash,
+ ttl: ENROLLMENT_TOKEN_TTL_SECONDS,
+ expiresAt: generated.expiresAt,
+ authMethodId: registry.id
+ },
+ tx
+ );
+ });
+
+ return {
+ ...record,
+ token: generated.plainToken,
+ gatewayName: gateway.name,
+ orgId: gateway.orgId
+ };
+ };
+
+ const revokeAccess = async ({ resource, actor }: TRevokeTokenDTO) => {
+ assertGatewayResource(resource, "auth-method");
+ await $checkPermission(actor, OrgPermissionGatewayActions.RevokeGatewayAccess);
+
+ const gateway = await gatewayV2DAL.findById(resource.id);
+ if (!gateway || gateway.orgId !== actor.orgId) {
+ throw new NotFoundError({ message: `Gateway ${resource.id} not found` });
+ }
+
+ const registry = await resourceAuthMethodDAL.findOne({ gatewayId: resource.id });
+ if (!registry) {
+ throw new NotFoundError({ message: "Gateway has no auth method configured" });
+ }
+ if (gateway.identityId) {
+ throw new BadRequestError({
+ message:
+ "Identity-bound gateways cannot be revoked directly. Create a new gateway with AWS or Token auth instead."
+ });
+ }
+
+ const result = await resourceTokenAuthDAL.transaction(async (tx) => {
+ let deletedTokenCount = 0;
+ if (registry.method === ResourceAuthMethodType.Token) {
+ const tokens = await resourceTokenAuthDAL.find({ authMethodId: registry.id }, { tx });
+ deletedTokenCount = tokens.length;
+ if (tokens.length > 0) {
+ await resourceTokenAuthDAL.delete({ authMethodId: registry.id }, tx);
+ }
+ }
+ await gatewayV2DAL.updateById(
+ gateway.id,
+ { $incr: { tokenVersion: 1 }, heartbeat: null, lastHealthCheckStatus: null },
+ tx
+ );
+ return { deletedTokenCount };
+ });
+
+ return {
+ gatewayName: gateway.name,
+ orgId: gateway.orgId,
+ method: registry.method as "aws" | "token",
+ deletedTokenCount: result.deletedTokenCount
+ };
+ };
+
+ const loginWithAws = async ({
+ resource,
+ iamHttpRequestMethod,
+ iamRequestBody,
+ iamRequestHeaders
+ }: TLoginWithAwsDTO) => {
+ assertGatewayResource(resource, "AWS");
+
+ const gateway = await gatewayV2DAL.findById(resource.id);
+ if (!gateway) {
+ throw new UnauthorizedError({ message: "Invalid gateway credentials" });
+ }
+
+ const registry = await resourceAuthMethodDAL.findOne({ gatewayId: gateway.id });
+ if (!registry || registry.method !== ResourceAuthMethodType.Aws) {
+ throw new UnauthorizedError({
+ message: "Gateway is not configured for AWS authentication",
+ detail: { reasonCode: "method_mismatch", gatewayId: gateway.id, orgId: gateway.orgId }
+ });
+ }
+
+ const config = await resourceAwsAuthDAL.findOne({ authMethodId: registry.id });
+ if (!config) {
+ throw new UnauthorizedError({
+ message: "Gateway is not configured for AWS authentication",
+ detail: { reasonCode: "config_missing", gatewayId: gateway.id, orgId: gateway.orgId }
+ });
+ }
+
+ const errorContext = { gatewayId: gateway.id, orgId: gateway.orgId, gatewayName: gateway.name };
+
+ const { Account, Arn } = await verifyStsAndExtractCaller({
+ iamHttpRequestMethod,
+ iamRequestBody,
+ iamRequestHeaders,
+ defaultStsEndpoint: config.stsEndpoint,
+ errorContext
+ });
+
+ validateAllowlists({
+ Account,
+ Arn,
+ allowedAccountIds: config.allowedAccountIds,
+ allowedPrincipalArns: config.allowedPrincipalArns,
+ errorContext
+ });
+
+ const refreshed = await gatewayV2DAL.updateById(gateway.id, {
+ $incr: { tokenVersion: 1 },
+ heartbeat: null,
+ lastHealthCheckStatus: null
+ });
+
+ const accessToken = mintGatewayJwt({
+ gatewayId: gateway.id,
+ orgId: gateway.orgId,
+ tokenVersion: refreshed.tokenVersion,
+ accessTokenTTL: 0
+ });
+
+ return {
+ accessToken,
+ gateway: refreshed,
+ config,
+ principalArn: Arn,
+ accountId: Account
+ };
+ };
+
+ // Single-use: row is deleted on consume, not flagged.
+ const loginWithToken = async ({ token }: TLoginWithTokenDTO) => {
+ const tokenHash = crypto.nativeCrypto.createHash("sha256").update(token).digest("hex");
+
+ const tokenRecord = await resourceTokenAuthDAL.findOne({ tokenHash });
+ if (!tokenRecord) {
+ throw new BadRequestError({ message: "Invalid enrollment token" });
+ }
+ if (tokenRecord.expiresAt < new Date()) {
+ await resourceTokenAuthDAL.deleteById(tokenRecord.id).catch(() => {});
+ throw new BadRequestError({ message: "Enrollment token has expired" });
+ }
+
+ const registry = await resourceAuthMethodDAL.findById(tokenRecord.authMethodId);
+ if (!registry || !registry.gatewayId) {
+ throw new BadRequestError({ message: "Enrollment token is not linked to a gateway" });
+ }
+ const linkedGatewayId = registry.gatewayId;
+
+ const gateway = await resourceTokenAuthDAL.transaction(async (tx) => {
+ // Reject concurrent consumption: if delete returns 0, another caller won the race.
+ const deleted = await resourceTokenAuthDAL.delete({ id: tokenRecord.id }, tx);
+ if (deleted.length === 0) {
+ throw new BadRequestError({ message: "Enrollment token has already been used" });
+ }
+ const existing = await gatewayV2DAL.findById(linkedGatewayId, tx);
+ if (!existing) throw new NotFoundError({ message: `Gateway ${linkedGatewayId} not found` });
+ return gatewayV2DAL.updateById(
+ existing.id,
+ { $incr: { tokenVersion: 1 }, heartbeat: null, lastHealthCheckStatus: null },
+ tx
+ );
+ });
+
+ const accessToken = mintGatewayJwt({
+ gatewayId: gateway.id,
+ orgId: gateway.orgId,
+ tokenVersion: gateway.tokenVersion,
+ accessTokenTTL: 0
+ });
+
+ return {
+ accessToken,
+ gatewayId: gateway.id,
+ gatewayName: gateway.name,
+ orgId: gateway.orgId,
+ enrollmentTokenId: tokenRecord.id
+ };
+ };
+
+ return {
+ getByGatewayId,
+ loadView,
+ canRevoke,
+ initAtCreate,
+ setMethod,
+ mintToken,
+ revokeAccess,
+ loginWithAws,
+ loginWithToken
+ };
+};
diff --git a/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts
new file mode 100644
index 0000000000..a6455308e0
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/resource-auth-method-types.ts
@@ -0,0 +1,52 @@
+import { OrgServiceActor } from "@app/lib/types";
+
+import { ResourceAuthMethodType, ResourceRef } from "./resource-auth-method-fns";
+
+export type TAwsAuthMethodConfig = {
+ stsEndpoint: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
+};
+
+export type TSetAuthMethodInput =
+ | ({ method: typeof ResourceAuthMethodType.Aws } & TAwsAuthMethodConfig)
+ | { method: typeof ResourceAuthMethodType.Token };
+
+export type TSetAuthMethodDTO = {
+ resource: ResourceRef;
+ authMethod: TSetAuthMethodInput;
+ actor: OrgServiceActor;
+};
+
+export type TGetAuthMethodDTO = {
+ resource: ResourceRef;
+ actor: OrgServiceActor;
+};
+
+export type TMintTokenDTO = TGetAuthMethodDTO;
+export type TRevokeTokenDTO = TGetAuthMethodDTO;
+
+export type TLoginWithAwsDTO = {
+ resource: ResourceRef;
+ iamHttpRequestMethod: string;
+ iamRequestBody: string;
+ iamRequestHeaders: string;
+};
+
+export type TLoginWithTokenDTO = {
+ token: string;
+};
+
+export type TAuthMethodView =
+ | {
+ method: typeof ResourceAuthMethodType.Aws;
+ config: TAwsAuthMethodConfig & { id: string; createdAt: Date; updatedAt: Date };
+ }
+ | {
+ method: typeof ResourceAuthMethodType.Token;
+ config: Record<string, never>;
+ }
+ | {
+ method: typeof ResourceAuthMethodType.Identity;
+ config: { identityId: string; identityName: string | null };
+ };
diff --git a/backend/src/ee/services/resource-auth-method/token-auth-dal.ts b/backend/src/ee/services/resource-auth-method/token-auth-dal.ts
new file mode 100644
index 0000000000..7819c19f32
--- /dev/null
+++ b/backend/src/ee/services/resource-auth-method/token-auth-dal.ts
@@ -0,0 +1,9 @@
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { ormify } from "@app/lib/knex";
+
+export type TResourceTokenAuthDALFactory = ReturnType<typeof resourceTokenAuthDALFactory>;
+
+export const resourceTokenAuthDALFactory = (db: TDbClient) => {
+ return ormify(db, TableName.ResourceTokenAuth);
+};
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 775a189e35..78399666be 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -88,7 +88,8 @@ export enum ApiDocsTags {
SamlSso = "SAML SSO",
LdapSso = "LDAP SSO",
Scim = "SCIM",
- Events = "Event Subscriptions"
+ Events = "Event Subscriptions",
+ GatewaysV3 = "Gateways"
}
export const GROUPS = {
@@ -3630,3 +3631,29 @@ export const SECRET_SHARING = {
id: "The ID of the shared secret to delete."
}
} as const;
+
+export const GATEWAYS = {
+ CREATE: {
+ name: "Name of the gateway.",
+ authMethod:
+ "Auth method to configure on the gateway. `aws` carries the AWS allowlists; `token` is configurationless and requires a separate POST /v3/gateways/:id/token call to mint the bootstrap token."
+ },
+ UPDATE: {
+ authMethod:
+ "Replacement auth method. Same shape as in create — `aws` with allowlists or `token` with no config. Existing gateways keep working until they restart and re-authenticate via the new method."
+ },
+ AUTH_METHOD: {
+ stsEndpoint: "The endpoint URL for the AWS STS API.",
+ allowedPrincipalArns:
+ "The comma-separated list of trusted IAM principal ARNs that are allowed to authenticate with Infisical.",
+ allowedAccountIds:
+ "The comma-separated list of trusted AWS account IDs that are allowed to authenticate with Infisical."
+ },
+ LOGIN: {
+ gatewayId: "The ID of the gateway logging in (AWS method only).",
+ iamHttpRequestMethod: "The HTTP request method used in the signed STS request.",
+ iamRequestBody: "The base64-encoded body of the signed STS request.",
+ iamRequestHeaders: "The base64-encoded headers of the sts:GetCallerIdentity signed request.",
+ token: "The one-time enrollment token previously issued for this gateway (token method only)."
+ }
+} as const;
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 5eefc5f9a1..2a3d3e06b2 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -62,7 +62,6 @@ import { orgGatewayConfigDALFactory } from "@app/ee/services/gateway/org-gateway
import { gatewayPoolDalFactory } from "@app/ee/services/gateway-pool/gateway-pool-dal";
import { gatewayPoolMembershipDalFactory } from "@app/ee/services/gateway-pool/gateway-pool-membership-dal";
import { gatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";
-import { gatewayEnrollmentTokenDALFactory } from "@app/ee/services/gateway-v2/gateway-enrollment-token-dal";
import { gatewayV2DalFactory } from "@app/ee/services/gateway-v2/gateway-v2-dal";
import { gatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";
import { orgGatewayConfigV2DalFactory } from "@app/ee/services/gateway-v2/org-gateway-config-v2-dal";
@@ -156,6 +155,10 @@ import { instanceRelayConfigDalFactory } from "@app/ee/services/relay/instance-r
import { orgRelayConfigDalFactory } from "@app/ee/services/relay/org-relay-config-dal";
import { relayDalFactory } from "@app/ee/services/relay/relay-dal";
import { relayServiceFactory } from "@app/ee/services/relay/relay-service";
+import { resourceAwsAuthDALFactory } from "@app/ee/services/resource-auth-method/aws-auth-dal";
+import { resourceAuthMethodDALFactory } from "@app/ee/services/resource-auth-method/resource-auth-method-dal";
+import { resourceAuthMethodServiceFactory } from "@app/ee/services/resource-auth-method/resource-auth-method-service";
+import { resourceTokenAuthDALFactory } from "@app/ee/services/resource-auth-method/token-auth-dal";
import { samlConfigDALFactory } from "@app/ee/services/saml-config/saml-config-dal";
import { samlConfigServiceFactory } from "@app/ee/services/saml-config/saml-config-service";
import { scimDALFactory } from "@app/ee/services/scim/scim-dal";
@@ -1297,7 +1300,9 @@ export const registerRoutes = async (
const orgRelayConfigDAL = orgRelayConfigDalFactory(db);
const relayDAL = relayDalFactory(db);
const gatewayV2DAL = gatewayV2DalFactory(db);
- const gatewayEnrollmentTokenDAL = gatewayEnrollmentTokenDALFactory(db);
+ const resourceTokenAuthDAL = resourceTokenAuthDALFactory(db);
+ const resourceAuthMethodDAL = resourceAuthMethodDALFactory(db);
+ const resourceAwsAuthDAL = resourceAwsAuthDALFactory(db);
const gatewayPoolDAL = gatewayPoolDalFactory(db);
const gatewayPoolMembershipDAL = gatewayPoolMembershipDalFactory(db);
@@ -1454,12 +1459,20 @@ export const registerRoutes = async (
userDAL
});
+ const resourceAuthMethodService = resourceAuthMethodServiceFactory({
+ resourceAuthMethodDAL,
+ resourceAwsAuthDAL,
+ resourceTokenAuthDAL,
+ gatewayV2DAL,
+ identityDAL,
+ permissionService
+ });
+
const gatewayV2Service = gatewayV2ServiceFactory({
kmsService,
relayService,
orgGatewayConfigV2DAL,
gatewayV2DAL,
- gatewayEnrollmentTokenDAL,
relayDAL,
permissionService,
orgDAL,
@@ -1471,7 +1484,8 @@ export const registerRoutes = async (
pamDiscoverySourceDAL,
identityKubernetesAuthDAL,
aiMcpServerDAL,
- pkiDiscoveryConfigDAL
+ pkiDiscoveryConfigDAL,
+ resourceAuthMethodService
});
const gatewayPoolService = gatewayPoolServiceFactory({
@@ -3297,6 +3311,7 @@ export const registerRoutes = async (
relay: relayService,
gatewayV2: gatewayV2Service,
gatewayPool: gatewayPoolService,
+ resourceAuthMethod: resourceAuthMethodService,
secretRotationV2: secretRotationV2Service,
microsoftTeams: microsoftTeamsService,
assumePrivileges: assumePrivilegeService,
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 5f870c8d31..62f3806a63 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -105,7 +105,10 @@ export enum PostHogEventTypes {
PamDiscoverySourceDeleted = "PAM Discovery Source Deleted",
PamDiscoveryScanTriggered = "PAM Discovery Scan Triggered",
PamRotationRuleCreated = "PAM Rotation Rule Created",
- PamRotationRuleDeleted = "PAM Rotation Rule Deleted"
+ PamRotationRuleDeleted = "PAM Rotation Rule Deleted",
+
+ ResourceAuthMethodLogin = "Resource Auth Method Login",
+ ResourceAuthMethodUpdated = "Resource Auth Method Updated"
}
export type TSecretModifiedEvent = {
@@ -822,6 +825,16 @@ export type TPamRotationRuleDeletedEvent = {
};
};
+export type TResourceAuthMethodEvent = {
+ event: PostHogEventTypes.ResourceAuthMethodLogin | PostHogEventTypes.ResourceAuthMethodUpdated;
+ properties: {
+ resourceType: "gateway";
+ resourceId: string;
+ orgId: string;
+ method: "aws" | "token";
+ };
+};
+
export type TPostHogEvent = { distinctId: string; organizationId?: string; organizationName?: string } & (
| TSecretModifiedEvent
| TAdminInitEvent
@@ -892,4 +905,5 @@ export type TPostHogEvent = { distinctId: string; organizationId?: string; organ
| TPamDiscoveryEvent
| TPamRotationRuleCreatedEvent
| TPamRotationRuleDeletedEvent
+ | TResourceAuthMethodEvent
);
diff --git a/docs/documentation/platform/gateways/gateway-deployment.mdx b/docs/documentation/platform/gateways/gateway-deployment.mdx
index 487eb9660f..ad44c3d2ec 100644
--- a/docs/documentation/platform/gateways/gateway-deployment.mdx
+++ b/docs/documentation/platform/gateways/gateway-deployment.mdx
@@ -18,10 +18,12 @@ This guide covers everything you need to deploy and configure Infisical Gateways
1. Navigate to **Organization Settings > Networking > Gateways**.
2. Click **Create Gateway**.
![Create Gateway button](/images/platform/gateways/gateway-create-button.png)
- 3. Enter a name for your gateway and select a relay (or use "Auto Select Relay").
+ 3. Enter a name for the gateway.
![Create Gateway form](/images/platform/gateways/gateway-create-form.png)
- 4. Choose your deployment method (CLI or systemd).
- 5. Copy the generated CLI command. The command includes a one-time enrollment token that expires in 1 hour.
+ 4. (Optional) Open the new gateway's detail page and click the edit icon next to **Authentication** to switch the auth method. Two methods are supported:
+ - **Token** (default): a one-time enrollment token (1h expiry) bootstraps the gateway.
+ - **AWS**: the gateway authenticates by signing an `sts:GetCallerIdentity` request with whatever AWS credentials it can resolve on the host (instance role, env vars, shared profile). Configure the allowed principal ARNs and/or account IDs that match your hosts.
+ 5. Click **Show deploy command** in the **Deployment** card. Pick a relay (or "Auto Select Relay") and copy the generated CLI command.
</Step>
<Step title="Install the Infisical CLI">
Make sure the Infisical CLI is installed on the target machine. See the [CLI Installation Guide](/cli/overview) for instructions.
@@ -41,39 +43,65 @@ This guide covers everything you need to deploy and configure Infisical Gateways
<Step title="Run the CLI Command">
Run the command you copied from the UI on the target machine. This single command enrolls the gateway and starts it immediately.
- <Tabs>
- <Tab title="Linux Server (Production)">
- For production deployments on Linux, install as a systemd service:
- ```bash
- sudo infisical gateway systemd install <gateway-name> \
- --enroll-method=token \
- --token=<enrollment-token> \
- --domain=<your-infisical-domain>
- sudo systemctl start infisical-gateway
- ```
-
- <Warning>
- The systemd install command requires a Linux operating system with root/sudo
- privileges.
- </Warning>
- </Tab>
- <Tab title="Development & Testing">
- For development or testing, run directly in the foreground:
- ```bash
- infisical gateway start my-gateway \
- --enroll-method=token \
- --token=<enrollment-token> \
- --domain=<your-infisical-domain>
- ```
- </Tab>
- </Tabs>
+ <AccordionGroup>
+ <Accordion title="Token Auth">
+ A one-time enrollment token (1h expiry) bootstraps the gateway.
+
+ <Tabs>
+ <Tab title="Linux (Production)">
+ ```bash
+ sudo infisical gateway systemd install <gateway-name> \
+ --enroll-method=token \
+ --token=<enrollment-token> \
+ --domain=<your-infisical-domain>
+ sudo systemctl start infisical-gateway
+ ```
+ </Tab>
+ <Tab title="Foreground">
+ ```bash
+ infisical gateway start <gateway-name> \
+ --enroll-method=token \
+ --token=<enrollment-token> \
+ --domain=<your-infisical-domain>
+ ```
+ </Tab>
+ </Tabs>
+ </Accordion>
+ <Accordion title="AWS Auth">
+ The host must have AWS credentials whose principal matches your allowlist. The gateway re-authenticates via STS on every start.
+
+ <Tabs>
+ <Tab title="Linux (Production)">
+ ```bash
+ sudo infisical gateway systemd install <gateway-name> \
+ --enroll-method=aws \
+ --gateway-id=<gateway-id> \
+ --domain=<your-infisical-domain>
+ sudo systemctl start infisical-gateway
+ ```
+ </Tab>
+ <Tab title="Foreground">
+ ```bash
+ infisical gateway start <gateway-name> \
+ --enroll-method=aws \
+ --gateway-id=<gateway-id> \
+ --domain=<your-infisical-domain>
+ ```
+ </Tab>
+ </Tabs>
+ </Accordion>
+ </AccordionGroup>
+
+ <Warning>
+ The systemd install command requires Linux with root/sudo privileges.
+ </Warning>
<Info>
- The enrollment token can only be used once and expires after 1 hour. If it expires, use the **Re-enroll** option in the gateway's context menu to generate a new one.
+ Token-method enrollment tokens are single-use and expire after 1 hour. If the token expires before deployment, click **Show deploy command** again on the detail page to generate a new one.
</Info>
<Info>
- You can safely re-run the same command to restart the gateway. It will detect the token has already been used and skip enrollment automatically.
+ You can safely re-run the same command to restart the gateway. The CLI detects the token has already been used locally and skips enrollment automatically.
</Info>
</Step>
<Step title="Verify Your Gateway Deployment">
@@ -84,13 +112,16 @@ This guide covers everything you need to deploy and configure Infisical Gateways
</Step>
</Steps>
-### Re-enrollment
+### Managing a gateway
-To move a gateway to a different machine or regenerate its credentials:
+From the gateway's detail page (click the gateway row in the list):
-1. Click the context menu (three dots) next to the gateway and select **Re-enroll**.
-2. Copy the new CLI command and run it on the new machine.
-3. The existing gateway continues running until the new machine enrolls. Once the new machine connects, the old machine's credentials are automatically revoked. This enables zero-downtime machine migrations.
+- **Show deploy command** — Generates a fresh enrollment token (token method) or re-displays the AWS start command. Clicking this on a token-method gateway does **not** disconnect the running gateway; the next login with the new token rotates credentials atomically.
+- **Edit auth method** — Switch between Token and AWS, or update the AWS allowlists. Existing gateways keep their JWT until they restart and re-authenticate.
+- **Options → Revoke Access** — Disconnects the running gateway and invalidates outstanding enrollment tokens. The gateway must re-authenticate to reconnect. Gated by the dedicated `revoke-gateway-access` permission, separate from `edit-gateways`.
+- **Options → Delete Gateway** — Permanently removes the gateway.
+
+To migrate a gateway to a different host with zero downtime: click **Show deploy command** to generate a fresh token, run it on the new host, and the new login will rotate credentials away from the old host.
## Frequently Asked Questions
@@ -132,7 +163,9 @@ If the gateway cannot connect to the relay:
</Accordion>
<Accordion title="How do I troubleshoot authentication failures?">
-Ensure the enrollment token has not expired or already been used. If the gateway was re-enrolled, the old machine's credentials are no longer valid. You can generate a new enrollment token using the **Re-enroll** option in the gateway's context menu.
+For token method: ensure the enrollment token has not expired or already been used. Open the gateway's detail page and click **Show deploy command** to generate a fresh token.
+
+For AWS method: ensure the host has AWS credentials available (instance role, env vars, or shared profile) and the resolved principal/account is in the allowlist on the gateway's detail page.
</Accordion>
<Accordion title="Where can I find gateway logs?">
@@ -146,16 +179,18 @@ Check gateway logs for detailed error information:
</Accordion>
<Accordion title="What happens if my enrollment token expires?">
-Enrollment tokens expire after 1 hour. If the token expires before you run the CLI command, click the context menu (three dots) next to the gateway and select **Re-enroll** to generate a new token.
+Enrollment tokens expire after 1 hour. If the token expires before deployment, open the gateway's detail page and click **Show deploy command** to generate a new one.
</Accordion>
<Accordion title="Where are gateway credentials stored?">
-Each gateway's access token and domain are saved to a config file scoped by gateway name:
+For **token-method** gateways, the access token and domain are saved to a config file scoped by gateway name:
- **Running as root/sudo:** `/etc/infisical/gateways/<name>.conf`
- **Running as a regular user:** `~/.infisical/gateways/<name>.conf`
-This allows multiple gateways to run on the same machine without conflicting. For systemd-based installations, the configuration is at `/etc/infisical/gateway.conf`. All config files are created with restricted permissions (0600) so only the owner can read them.
+For **AWS-method** gateways, no JWT is persisted to disk. The gateway re-authenticates by signing a fresh STS request on every start using the host's AWS credentials. Only the gateway id and domain are stored locally.
+
+For systemd-based installations, the configuration is at `/etc/infisical/gateway.conf`. All config files are created with restricted permissions (0600).
</Accordion>
<Accordion title="Can I run multiple gateways on the same machine?">
diff --git a/docs/internals/permissions/organization-permissions.mdx b/docs/internals/permissions/organization-permissions.mdx
index 43ac4ec02c..b0f82e8583 100644
--- a/docs/internals/permissions/organization-permissions.mdx
+++ b/docs/internals/permissions/organization-permissions.mdx
@@ -221,13 +221,14 @@ Supports conditions and permission inversion
#### Subject: `gateway`
-| Action | Description |
-| ----------------- | --------------------------------- |
-| `list-gateways` | View all organization gateways |
-| `create-gateways` | Add new gateways to organization |
-| `edit-gateways` | Modify existing gateway settings |
-| `delete-gateways` | Remove gateways from organization |
-| `attach-gateways` | Attach gateways to resources |
+| Action | Description |
+| ----------------------- | ------------------------------------------------------------- |
+| `list-gateways` | View all organization gateways |
+| `create-gateways` | Add new gateways to organization |
+| `edit-gateways` | Modify existing gateway settings |
+| `delete-gateways` | Remove gateways from organization |
+| `attach-gateways` | Attach gateways to resources |
+| `revoke-gateway-access` | Disconnect a running gateway and invalidate enrollment tokens |
#### Subject: `gateway-pool`
diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts
index ce16ebc2ab..adcf0aba4a 100644
--- a/frontend/src/const/routes.ts
+++ b/frontend/src/const/routes.ts
@@ -70,8 +70,12 @@ export const ROUTE_PATHS = Object.freeze({
)
},
NetworkingPage: setRoute(
- "/organizations/$orgId/networking",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
+ "/organizations/$orgId/networking/",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/"
+ ),
+ GatewayDetailsByIDPage: setRoute(
+ "/organizations/$orgId/networking/gateways/$gatewayId",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId"
)
},
SecretManager: {
diff --git a/frontend/src/context/OrgPermissionContext/types.ts b/frontend/src/context/OrgPermissionContext/types.ts
index a5862bd7e9..05d3b2b7d8 100644
--- a/frontend/src/context/OrgPermissionContext/types.ts
+++ b/frontend/src/context/OrgPermissionContext/types.ts
@@ -26,7 +26,8 @@ export enum OrgGatewayPermissionActions {
ListGateways = "list-gateways",
EditGateways = "edit-gateways",
DeleteGateways = "delete-gateways",
- AttachGateways = "attach-gateways"
+ AttachGateways = "attach-gateways",
+ RevokeGatewayAccess = "revoke-gateway-access"
}
export enum OrgGatewayPoolPermissionActions {
diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx
index 9b42ae3a74..2f18cfdb46 100644
--- a/frontend/src/hooks/api/auditLogs/constants.tsx
+++ b/frontend/src/hooks/api/auditLogs/constants.tsx
@@ -404,7 +404,14 @@ export const eventToNameMap: { [K in EventType]: string } = {
// External Migration
[EventType.EXTERNAL_MIGRATION_CREATE]: "Create External Migration",
[EventType.EXTERNAL_MIGRATION_UPDATE]: "Update External Migration",
- [EventType.EXTERNAL_MIGRATION_DELETE]: "Delete External Migration"
+ [EventType.EXTERNAL_MIGRATION_DELETE]: "Delete External Migration",
+ [EventType.GATEWAY_CREATE]: "Create gateway",
+ [EventType.GATEWAY_ENROLL]: "Enroll gateway (legacy)",
+ [EventType.GATEWAY_ENROLLMENT_TOKEN_CREATE]: "Generate gateway enrollment token",
+ [EventType.RESOURCE_AUTH_METHOD_LOGIN]: "Gateway login",
+ [EventType.RESOURCE_AUTH_METHOD_LOGIN_FAILED]: "Gateway login failed",
+ [EventType.RESOURCE_AUTH_METHOD_UPDATE]: "Update gateway auth method",
+ [EventType.RESOURCE_AUTH_METHOD_REVOKE]: "Revoke gateway access"
};
export const userAgentTypeToNameMap: { [K in UserAgentType]: string } = {
diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx
index 1c4427c516..1c74324712 100644
--- a/frontend/src/hooks/api/auditLogs/enums.tsx
+++ b/frontend/src/hooks/api/auditLogs/enums.tsx
@@ -398,5 +398,14 @@ export enum EventType {
// External Migration
EXTERNAL_MIGRATION_CREATE = "external-migration-create",
EXTERNAL_MIGRATION_UPDATE = "external-migration-update",
- EXTERNAL_MIGRATION_DELETE = "external-migration-delete"
+ EXTERNAL_MIGRATION_DELETE = "external-migration-delete",
+
+ // Gateway
+ GATEWAY_CREATE = "gateway-create",
+ GATEWAY_ENROLL = "gateway-enroll",
+ GATEWAY_ENROLLMENT_TOKEN_CREATE = "gateway-enrollment-token-create",
+ RESOURCE_AUTH_METHOD_LOGIN = "resource-auth-method-login",
+ RESOURCE_AUTH_METHOD_LOGIN_FAILED = "resource-auth-method-login-failed",
+ RESOURCE_AUTH_METHOD_UPDATE = "resource-auth-method-update",
+ RESOURCE_AUTH_METHOD_REVOKE = "resource-auth-method-revoke"
}
diff --git a/frontend/src/hooks/api/gateways-v2/mutations.tsx b/frontend/src/hooks/api/gateways-v2/mutations.tsx
index eeffc4f66e..d02c997a5b 100644
--- a/frontend/src/hooks/api/gateways-v2/mutations.tsx
+++ b/frontend/src/hooks/api/gateways-v2/mutations.tsx
@@ -3,11 +3,27 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { gatewaysQueryKeys } from "../gateways/queries";
-import { TGatewayV2 } from "./types";
+import { gatewaysV2QueryKeys } from "./queries";
+import {
+ SettableAuthMethodInput,
+ TGatewayEnrollmentToken,
+ TGatewayV2WithAuthMethod
+} from "./types";
-const invalidateGatewayQueries = (queryClient: ReturnType<typeof useQueryClient>) => {
+const invalidateGatewayQueries = (
+ queryClient: ReturnType<typeof useQueryClient>,
+ gatewayId?: string
+) => {
queryClient.invalidateQueries(gatewaysQueryKeys.list());
queryClient.invalidateQueries(gatewaysQueryKeys.listWithTokens());
+ if (gatewayId) {
+ queryClient.invalidateQueries({ queryKey: gatewaysV2QueryKeys.byIdKey(gatewayId) });
+ queryClient.invalidateQueries({
+ queryKey: gatewaysV2QueryKeys.connectedResourcesKey(gatewayId)
+ });
+ } else {
+ queryClient.invalidateQueries({ queryKey: gatewaysV2QueryKeys.allKey() });
+ }
};
export const useDeleteGatewayV2ById = () => {
@@ -16,9 +32,7 @@ export const useDeleteGatewayV2ById = () => {
mutationFn: (id: string) => {
return apiRequest.delete(`/api/v2/gateways/${id}`);
},
- onSuccess: () => {
- invalidateGatewayQueries(queryClient);
- }
+ onSuccess: (_, id) => invalidateGatewayQueries(queryClient, id)
});
};
@@ -28,36 +42,73 @@ export const useTriggerGatewayV2Heartbeat = () => {
mutationFn: (id: string) => {
return apiRequest.post(`/api/v2/gateways/${id}/heartbeat`);
},
- onSettled: () => {
- invalidateGatewayQueries(queryClient);
- }
+ onSettled: (_, __, id) => invalidateGatewayQueries(queryClient, id)
});
};
export const useCreateGateway = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: async ({ name }: { name: string }) => {
- const { data } = await apiRequest.post<TGatewayV2>("/api/v3/gateways", { name });
+ mutationFn: async ({
+ name,
+ authMethod
+ }: {
+ name: string;
+ authMethod: SettableAuthMethodInput;
+ }) => {
+ const { data } = await apiRequest.post<TGatewayV2WithAuthMethod>("/api/v3/gateways", {
+ name,
+ authMethod
+ });
return data;
},
- onSuccess: () => {
- invalidateGatewayQueries(queryClient);
- }
+ onSuccess: (gateway) => invalidateGatewayQueries(queryClient, gateway.id)
});
};
-export const useConfigureGatewayTokenAuth = () => {
+export const useUpdateGateway = () => {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({
+ gatewayId,
+ authMethod
+ }: {
+ gatewayId: string;
+ authMethod?: SettableAuthMethodInput;
+ }) => {
+ const { data } = await apiRequest.patch<TGatewayV2WithAuthMethod>(
+ `/api/v3/gateways/${gatewayId}`,
+ { authMethod }
+ );
+ return data;
+ },
+ onSuccess: (_, { gatewayId }) => invalidateGatewayQueries(queryClient, gatewayId)
+ });
+};
+
+export const useMintGatewayToken = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ gatewayId }: { gatewayId: string }) => {
- const { data } = await apiRequest.post<{ token: string; expiresAt: string }>(
- `/api/v3/gateways/${gatewayId}/token-auth/configure`
+ const { data } = await apiRequest.post<TGatewayEnrollmentToken>(
+ `/api/v3/gateways/${gatewayId}/token-auth/generate-enrollment-token`
);
return data;
},
- onSuccess: () => {
- invalidateGatewayQueries(queryClient);
- }
+ onSuccess: (_, { gatewayId }) => invalidateGatewayQueries(queryClient, gatewayId)
+ });
+};
+
+export const useRevokeGatewayAccess = () => {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({ gatewayId }: { gatewayId: string }) => {
+ const { data } = await apiRequest.post<{
+ method: "aws" | "token";
+ deletedTokenCount: number;
+ }>(`/api/v3/gateways/${gatewayId}/revoke`);
+ return data;
+ },
+ onSuccess: (_, { gatewayId }) => invalidateGatewayQueries(queryClient, gatewayId)
});
};
diff --git a/frontend/src/hooks/api/gateways-v2/queries.tsx b/frontend/src/hooks/api/gateways-v2/queries.tsx
index 3dffca664d..d7b442577a 100644
--- a/frontend/src/hooks/api/gateways-v2/queries.tsx
+++ b/frontend/src/hooks/api/gateways-v2/queries.tsx
@@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
-import { TGatewayConnectedResources } from "./types";
+import { TGatewayConnectedResources, TGatewayV2WithAuthMethod } from "./types";
export const gatewaysV2QueryKeys = {
allKey: () => ["gateways-v2"],
@@ -20,9 +20,27 @@ export const gatewaysV2QueryKeys = {
return data;
},
enabled: Boolean(gatewayId)
+ }),
+ byIdKey: (gatewayId: string) => [...gatewaysV2QueryKeys.allKey(), "by-id", gatewayId],
+ byId: (gatewayId: string) => ({
+ queryKey: gatewaysV2QueryKeys.byIdKey(gatewayId),
+ // Auth-method state can change via PATCH from this same view, so don't cache.
+ staleTime: 0,
+ gcTime: 0,
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TGatewayV2WithAuthMethod>(
+ `/api/v3/gateways/${gatewayId}`
+ );
+ return data;
+ },
+ enabled: Boolean(gatewayId)
})
};
export const useGetGatewayConnectedResources = (gatewayId: string) => {
return useQuery(gatewaysV2QueryKeys.connectedResources(gatewayId));
};
+
+export const useGetGatewayV2ById = (gatewayId: string) => {
+ return useQuery(gatewaysV2QueryKeys.byId(gatewayId));
+};
diff --git a/frontend/src/hooks/api/gateways-v2/types.ts b/frontend/src/hooks/api/gateways-v2/types.ts
index d2281fceed..f2c0a2379c 100644
--- a/frontend/src/hooks/api/gateways-v2/types.ts
+++ b/frontend/src/hooks/api/gateways-v2/types.ts
@@ -11,25 +11,51 @@ export type TGatewayV2 = {
updatedAt: string;
heartbeat: string | null;
lastHealthCheckStatus: GatewayHealthCheckStatus | null;
+ canRevoke: boolean;
connectedResourcesCount: number;
identity: {
name: string;
id: string;
} | null;
- enrollmentTokenStatus: "pending" | "expired" | null;
};
-export type TGatewayEnrollmentToken = {
+export type GatewayAwsAuthConfig = {
id: string;
- ttl: number;
- expiresAt: string;
- usedAt: string | null;
- gatewayId: string | null;
+ stsEndpoint: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
createdAt: string;
+ updatedAt: string;
+};
+
+export type GatewayTokenAuthConfig = Record<string, never>;
+
+export type GatewayIdentityAuthConfig = {
+ identityId: string;
+ identityName: string | null;
};
-export type TCreateGatewayEnrollmentTokenResponse = TGatewayEnrollmentToken & {
+export type GatewayAuthMethodView =
+ | { method: "aws"; config: GatewayAwsAuthConfig }
+ | { method: "token"; config: GatewayTokenAuthConfig }
+ | { method: "identity"; config: GatewayIdentityAuthConfig };
+
+export type TGatewayV2WithAuthMethod = TGatewayV2 & {
+ authMethod: GatewayAuthMethodView;
+};
+
+export type SettableAuthMethodInput =
+ | {
+ method: "aws";
+ stsEndpoint?: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
+ }
+ | { method: "token" };
+
+export type TGatewayEnrollmentToken = {
token: string;
+ expiresAt: string;
};
export type TGatewayConnectedAppConnection = {
diff --git a/frontend/src/hooks/api/gateways/queries.tsx b/frontend/src/hooks/api/gateways/queries.tsx
index 89f662db9b..e8919d73e2 100644
--- a/frontend/src/hooks/api/gateways/queries.tsx
+++ b/frontend/src/hooks/api/gateways/queries.tsx
@@ -44,26 +44,8 @@ export const gatewaysQueryKeys = {
]);
return [
- ...data.gateways.map((g) => ({
- ...g,
- isV1: true as const,
- isPending: false as const,
- hasReEnrollToken: false as const
- })),
- ...dataV2.map((g) => {
- const hasHeartbeat = !!g.heartbeat;
- const hasToken =
- g.enrollmentTokenStatus === "pending" || g.enrollmentTokenStatus === "expired";
- const isPending = hasToken && !hasHeartbeat;
- const hasReEnrollToken = g.enrollmentTokenStatus === "pending" && hasHeartbeat;
-
- return {
- ...g,
- isV1: false as const,
- isPending,
- hasReEnrollToken
- };
- })
+ ...data.gateways.map((g) => ({ ...g, isV1: true as const })),
+ ...dataV2.map((g) => ({ ...g, isV1: false as const }))
];
}
})
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/GatewayDetailsByIDPage.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/GatewayDetailsByIDPage.tsx
new file mode 100644
index 0000000000..60ca236578
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/GatewayDetailsByIDPage.tsx
@@ -0,0 +1,84 @@
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+import { Link, useParams } from "@tanstack/react-router";
+import { ChevronLeftIcon } from "lucide-react";
+
+import { OrgPermissionCan } from "@app/components/permissions";
+import { EmptyState } from "@app/components/v2";
+import { PageLoader } from "@app/components/v3";
+import { ROUTE_PATHS } from "@app/const/routes";
+import { useOrganization } from "@app/context";
+import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
+import { useGetGatewayV2ById } from "@app/hooks/api/gateways-v2";
+
+import { GatewayConnectedResourcesSection } from "./components/GatewayConnectedResourcesSection/GatewayConnectedResourcesSection";
+import { GatewayDeploySection } from "./components/GatewayDeploySection/GatewayDeploySection";
+import { GatewayDetailsCard } from "./components/GatewayDetailsCard/GatewayDetailsCard";
+import { GatewayPageHeader } from "./components/GatewayPageHeader/GatewayPageHeader";
+
+const Page = () => {
+ const params = useParams({ from: ROUTE_PATHS.Organization.GatewayDetailsByIDPage.id });
+ const gatewayId = params.gatewayId as string;
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
+ const { data: gateway, isPending } = useGetGatewayV2ById(gatewayId);
+
+ if (isPending) {
+ return <PageLoader />;
+ }
+
+ if (!gateway) {
+ return <EmptyState title="Gateway not found" />;
+ }
+
+ return (
+ <div className="mx-auto flex max-w-8xl flex-col">
+ <Link
+ to="/organizations/$orgId/networking"
+ params={{ orgId }}
+ search={{ selectedTab: "gateways" }}
+ className="mb-4 flex w-fit items-center gap-x-1 text-sm text-mineshaft-400 transition hover:text-mineshaft-400/80"
+ >
+ <ChevronLeftIcon size={16} />
+ Gateways
+ </Link>
+ <GatewayPageHeader gateway={gateway} orgId={orgId} />
+ <div className="flex flex-col gap-5 lg:flex-row">
+ <div className="flex w-full flex-col gap-y-5 lg:max-w-[24rem]">
+ <GatewayDetailsCard gateway={gateway} />
+ </div>
+ <div className="flex flex-1 flex-col gap-y-5">
+ <GatewayDeploySection
+ gatewayId={gatewayId}
+ gatewayName={gateway.name}
+ authMethod={gateway.authMethod}
+ isFirstTimeSetup={!gateway.heartbeat}
+ />
+ <GatewayConnectedResourcesSection gatewayId={gatewayId} />
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export const GatewayDetailsByIDPage = () => {
+ const { t } = useTranslation();
+ return (
+ <>
+ <Helmet>
+ <title>{t("common.head-title", { title: t("settings.org.title") })}</title>
+ <link rel="icon" href="/infisical.ico" />
+ </Helmet>
+ <OrgPermissionCan
+ passThrough={false}
+ I={OrgGatewayPermissionActions.ListGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ <Page />
+ </OrgPermissionCan>
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/AwsStartCommandDialog.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/AwsStartCommandDialog.tsx
new file mode 100644
index 0000000000..f425677f52
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/AwsStartCommandDialog.tsx
@@ -0,0 +1,163 @@
+import { useMemo, useState } from "react";
+import { faCopy, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ FilterableSelect,
+ FormControl,
+ FormLabel,
+ IconButton,
+ Input,
+ Modal,
+ ModalClose,
+ ModalContent,
+ Tab,
+ TabList,
+ TabPanel,
+ Tabs
+} from "@app/components/v2";
+import { Badge } from "@app/components/v3/generic/Badge";
+import { useGetRelays } from "@app/hooks/api/relays/queries";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ gatewayId: string;
+ gatewayName: string;
+};
+
+const AUTO_RELAY_OPTION = { id: "_auto", name: "Auto Select Relay" };
+
+// Renders the AWS-method start command. Mirrors EnrollmentTokenDialog.
+export const AwsStartCommandDialog = ({ isOpen, onOpenChange, gatewayId, gatewayName }: Props) => {
+ const { protocol, hostname, port } = window.location;
+ const portSuffix = port && port !== "80" ? `:${port}` : "";
+ const siteURL = `${protocol}//${hostname}${portSuffix}`;
+
+ const { data: relays, isPending: isRelaysLoading } = useGetRelays();
+ const [relay, setRelay] = useState<{ id: string; name: string }>(AUTO_RELAY_OPTION);
+
+ const resolvedRelayName = relay.id === "_auto" ? "" : relay.name;
+
+ const cliCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ return `infisical gateway start ${gatewayName} --enroll-method=aws --gateway-id=${gatewayId}${relayPart} --domain=${siteURL}`;
+ }, [gatewayName, gatewayId, resolvedRelayName, siteURL]);
+
+ const systemdInstallCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ return `sudo infisical gateway systemd install ${gatewayName} --enroll-method=aws --gateway-id=${gatewayId}${relayPart} --domain=${siteURL}`;
+ }, [gatewayName, gatewayId, resolvedRelayName, siteURL]);
+
+ const startServiceCommand = "sudo systemctl start infisical-gateway";
+
+ const copy = (text: string, label: string) => {
+ navigator.clipboard.writeText(text);
+ createNotification({ type: "info", text: `${label} copied to clipboard` });
+ };
+
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ className="max-w-2xl"
+ title={`Deploy command for ${gatewayName}`}
+ subTitle="Run the following command on the host where you want to deploy the gateway."
+ bodyClassName="overflow-visible"
+ >
+ <div className="mb-4">
+ <div className="mb-0.5 flex items-center gap-2">
+ <FormLabel label="Auth Method" className="mb-0 text-foreground" />
+ <Badge variant="info">AWS Auth</Badge>
+ </div>
+ <p className="mt-1 text-xs text-mineshaft-400">
+ The host must have AWS credentials whose principal matches your allowlist. To use a
+ different auth method, update it in the gateway settings.
+ </p>
+ </div>
+ <FormControl
+ label="Relay"
+ tooltipText="The relay this gateway should connect through. Auto Select picks one server-side at connect time."
+ >
+ <FilterableSelect
+ value={relay}
+ onChange={(newValue) =>
+ setRelay((newValue as { id: string; name: string }) ?? AUTO_RELAY_OPTION)
+ }
+ isLoading={isRelaysLoading}
+ options={[AUTO_RELAY_OPTION, ...(relays || [])]}
+ placeholder="Select relay..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+
+ <Tabs defaultValue="cli" className="mt-2">
+ <TabList>
+ <Tab value="cli">CLI</Tab>
+ <Tab value="systemd">CLI (systemd)</Tab>
+ </TabList>
+ <TabPanel value="cli">
+ <div className="flex gap-2">
+ <Input value={cliCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(cliCommand, "Command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ </TabPanel>
+ <TabPanel value="systemd">
+ <FormLabel label="Installation Command" />
+ <div className="flex gap-2">
+ <Input value={systemdInstallCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy install"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(systemdInstallCommand, "Installation command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ <FormLabel label="Start the Gateway Service" className="mt-4" />
+ <div className="flex gap-2">
+ <Input value={startServiceCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy start"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(startServiceCommand, "Start command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ </TabPanel>
+ </Tabs>
+ <a
+ href="https://infisical.com/docs/cli/overview"
+ target="_blank"
+ rel="noreferrer"
+ className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors hover:border-yellow-400 hover:text-yellow-400"
+ >
+ <span>Install the Infisical CLI</span>
+ <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />
+ </a>
+ <div className="mt-6 flex items-center">
+ <ModalClose asChild>
+ <Button className="mr-4" size="sm" colorSchema="secondary">
+ Done
+ </Button>
+ </ModalClose>
+ </div>
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/EnrollmentTokenDialog.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/EnrollmentTokenDialog.tsx
new file mode 100644
index 0000000000..acb5a1168d
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/EnrollmentTokenDialog.tsx
@@ -0,0 +1,168 @@
+import { useMemo, useState } from "react";
+import { faCopy, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ FilterableSelect,
+ FormControl,
+ FormLabel,
+ IconButton,
+ Input,
+ Modal,
+ ModalClose,
+ ModalContent,
+ Tab,
+ TabList,
+ TabPanel,
+ Tabs
+} from "@app/components/v2";
+import { Badge } from "@app/components/v3/generic/Badge";
+import { useGetRelays } from "@app/hooks/api/relays/queries";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ gatewayName: string;
+ enrollmentToken: string;
+};
+
+const AUTO_RELAY_OPTION = { id: "_auto", name: "Auto Select Relay" };
+
+// Renders the token-method start command after a fresh enrollment token has been minted.
+export const EnrollmentTokenDialog = ({
+ isOpen,
+ onOpenChange,
+ gatewayName,
+ enrollmentToken
+}: Props) => {
+ const { protocol, hostname, port } = window.location;
+ const portSuffix = port && port !== "80" ? `:${port}` : "";
+ const siteURL = `${protocol}//${hostname}${portSuffix}`;
+
+ const { data: relays, isPending: isRelaysLoading } = useGetRelays();
+ const [relay, setRelay] = useState<{ id: string; name: string }>(AUTO_RELAY_OPTION);
+
+ const resolvedRelayName = relay.id === "_auto" ? "" : relay.name;
+
+ const cliCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ return `infisical gateway start ${gatewayName} --enroll-method=token --token=${enrollmentToken}${relayPart} --domain=${siteURL}`;
+ }, [gatewayName, enrollmentToken, resolvedRelayName, siteURL]);
+
+ const systemdInstallCommand = useMemo(() => {
+ const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
+ return `sudo infisical gateway systemd install ${gatewayName} --enroll-method=token --token=${enrollmentToken}${relayPart} --domain=${siteURL}`;
+ }, [gatewayName, enrollmentToken, resolvedRelayName, siteURL]);
+
+ const startServiceCommand = "sudo systemctl start infisical-gateway";
+
+ const copy = (text: string, label: string) => {
+ navigator.clipboard.writeText(text);
+ createNotification({ type: "info", text: `${label} copied to clipboard` });
+ };
+
+ return (
+ <Modal isOpen={isOpen} onOpenChange={onOpenChange}>
+ <ModalContent
+ className="max-w-2xl"
+ title={`Deploy command for ${gatewayName}`}
+ subTitle="Run the following command on the machine where you want to deploy the gateway."
+ bodyClassName="overflow-visible"
+ >
+ <div className="mb-4">
+ <div className="mb-0.5 flex items-center gap-2">
+ <FormLabel label="Auth Method" className="mb-0 text-foreground" />
+ <Badge variant="info">Token Auth</Badge>
+ </div>
+ <p className="mt-1 text-xs text-mineshaft-400">
+ The enrollment token expires in 1 hour and can only be used once. To use a different
+ auth method, update it in the gateway settings.
+ </p>
+ </div>
+ <FormControl
+ label="Relay"
+ tooltipText="The relay this gateway should connect through. Auto Select picks one server-side at connect time."
+ >
+ <FilterableSelect
+ value={relay}
+ onChange={(newValue) =>
+ setRelay((newValue as { id: string; name: string }) ?? AUTO_RELAY_OPTION)
+ }
+ isLoading={isRelaysLoading}
+ options={[AUTO_RELAY_OPTION, ...(relays || [])]}
+ placeholder="Select relay..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+
+ <Tabs defaultValue="cli" className="mt-2">
+ <TabList>
+ <Tab value="cli">CLI</Tab>
+ <Tab value="systemd">CLI (systemd)</Tab>
+ </TabList>
+ <TabPanel value="cli">
+ <div className="flex gap-2">
+ <Input value={cliCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(cliCommand, "Command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ </TabPanel>
+ <TabPanel value="systemd">
+ <FormLabel label="Installation Command" />
+ <div className="flex gap-2">
+ <Input value={systemdInstallCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy install"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(systemdInstallCommand, "Installation command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ <FormLabel label="Start the Gateway Service" className="mt-4" />
+ <div className="flex gap-2">
+ <Input value={startServiceCommand} isDisabled />
+ <IconButton
+ ariaLabel="copy start"
+ variant="outline_bg"
+ colorSchema="secondary"
+ onClick={() => copy(startServiceCommand, "Start command")}
+ className="w-10"
+ >
+ <FontAwesomeIcon icon={faCopy} />
+ </IconButton>
+ </div>
+ </TabPanel>
+ </Tabs>
+ <a
+ href="https://infisical.com/docs/cli/overview"
+ target="_blank"
+ rel="noreferrer"
+ className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors hover:border-yellow-400 hover:text-yellow-400"
+ >
+ <span>Install the Infisical CLI</span>
+ <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />
+ </a>
+ <div className="mt-6 flex items-center">
+ <ModalClose asChild>
+ <Button className="mr-4" size="sm" colorSchema="secondary">
+ Done
+ </Button>
+ </ModalClose>
+ </div>
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GatewayAuthMethodModal.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GatewayAuthMethodModal.tsx
new file mode 100644
index 0000000000..816a2fd7a4
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/GatewayAuthMethodModal.tsx
@@ -0,0 +1,240 @@
+import { useEffect } from "react";
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldContent,
+ FieldError,
+ FieldLabel,
+ FilterableSelect,
+ Input
+} from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import { useUpdateGateway } from "@app/hooks/api/gateways-v2";
+import { GatewayAuthMethodView } from "@app/hooks/api/gateways-v2/types";
+
+type SettableMethod = "aws" | "token";
+
+const METHOD_OPTIONS: { value: SettableMethod; label: string }[] = [
+ { value: "token", label: "Token Auth" },
+ { value: "aws", label: "AWS Auth" }
+];
+
+const schema = z
+ .object({
+ method: z.enum(["aws", "token"]),
+ stsEndpoint: z.string(),
+ allowedPrincipalArns: z.string(),
+ allowedAccountIds: z.string()
+ })
+ .superRefine((data, ctx) => {
+ if (data.method === "aws") {
+ const hasArns = data.allowedPrincipalArns.trim().length > 0;
+ const hasAccountIds = data.allowedAccountIds.trim().length > 0;
+ if (!hasArns && !hasAccountIds) {
+ const message = "At least one of allowed principal ARNs or allowed account IDs must be set";
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["allowedPrincipalArns"],
+ message
+ });
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["allowedAccountIds"],
+ message
+ });
+ }
+ }
+ });
+
+type FormData = z.infer<typeof schema>;
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ gatewayId: string;
+ currentMethod: GatewayAuthMethodView;
+};
+
+export const GatewayAuthMethodModal = ({
+ isOpen,
+ onOpenChange,
+ gatewayId,
+ currentMethod
+}: Props) => {
+ const { mutateAsync: updateGateway, isPending } = useUpdateGateway();
+ const { isSubOrganization } = useOrganization();
+
+ const initialMethod: SettableMethod = currentMethod.method === "aws" ? "aws" : "token";
+ const initialAws = currentMethod.method === "aws" ? currentMethod.config : null;
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { isSubmitting, isDirty }
+ } = useForm<FormData>({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ method: initialMethod,
+ stsEndpoint: initialAws?.stsEndpoint ?? "https://sts.amazonaws.com/",
+ allowedPrincipalArns: initialAws?.allowedPrincipalArns ?? "",
+ allowedAccountIds: initialAws?.allowedAccountIds ?? ""
+ }
+ });
+
+ useEffect(() => {
+ if (isOpen) {
+ reset({
+ method: initialMethod,
+ stsEndpoint: initialAws?.stsEndpoint ?? "https://sts.amazonaws.com/",
+ allowedPrincipalArns: initialAws?.allowedPrincipalArns ?? "",
+ allowedAccountIds: initialAws?.allowedAccountIds ?? ""
+ });
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isOpen]);
+
+ const method = watch("method");
+
+ const onSubmit = async (form: FormData) => {
+ try {
+ if (form.method === "aws") {
+ await updateGateway({
+ gatewayId,
+ authMethod: {
+ method: "aws",
+ stsEndpoint: form.stsEndpoint,
+ allowedPrincipalArns: form.allowedPrincipalArns,
+ allowedAccountIds: form.allowedAccountIds
+ }
+ });
+ } else {
+ await updateGateway({ gatewayId, authMethod: { method: "token" } });
+ }
+ createNotification({ type: "success", text: "Auth method updated" });
+ onOpenChange(false);
+ } catch {
+ createNotification({ type: "error", text: "Failed to update auth method" });
+ }
+ };
+
+ return (
+ <Dialog open={isOpen} onOpenChange={onOpenChange}>
+ <DialogContent className="max-w-lg overflow-visible">
+ <DialogHeader>
+ <DialogTitle>Edit Auth Method</DialogTitle>
+ <DialogDescription>
+ Switch the gateway&apos;s auth method or update the current method&apos;s config.
+ </DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onSubmit)} className="space-y-4">
+ <Controller
+ control={control}
+ name="method"
+ render={({ field }) => {
+ const selected =
+ METHOD_OPTIONS.find((o) => o.value === field.value) ?? METHOD_OPTIONS[0];
+ return (
+ <Field>
+ <FieldLabel>Method</FieldLabel>
+ <FieldContent>
+ <FilterableSelect
+ value={selected}
+ onChange={(opt) => {
+ const next = opt as { value: SettableMethod } | null;
+ if (next) field.onChange(next.value);
+ }}
+ options={METHOD_OPTIONS}
+ isSearchable={false}
+ isClearable={false}
+ getOptionLabel={(o) => o.label}
+ getOptionValue={(o) => o.value}
+ />
+ </FieldContent>
+ </Field>
+ );
+ }}
+ />
+
+ {method === "aws" && (
+ <>
+ <Controller
+ control={control}
+ name="allowedPrincipalArns"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>Allowed Principal ARNs</FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ isError={Boolean(error)}
+ placeholder="arn:aws:iam::123456789012:role/MyRoleName, arn:aws:iam::123456789012:user/MyUserName..."
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="allowedAccountIds"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>Allowed Account IDs</FieldLabel>
+ <FieldContent>
+ <Input {...field} isError={Boolean(error)} placeholder="123456789012, ..." />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ <Controller
+ control={control}
+ name="stsEndpoint"
+ render={({ field, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel>STS Endpoint</FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ isError={Boolean(error)}
+ placeholder="https://sts.amazonaws.com/"
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
+ )}
+ />
+ </>
+ )}
+
+ <DialogFooter className="gap-2 sm:gap-2">
+ <Button type="button" variant="ghost" onClick={() => onOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ variant={isSubOrganization ? "sub-org" : "org"}
+ isPending={isSubmitting || isPending}
+ isDisabled={isSubmitting || isPending || !isDirty}
+ >
+ Update
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAuth.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAuth.tsx
new file mode 100644
index 0000000000..13291be879
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAuth.tsx
@@ -0,0 +1,18 @@
+import { GatewayAuthMethodView } from "@app/hooks/api/gateways-v2/types";
+
+import { ViewGatewayAwsAuthContent } from "./ViewGatewayAwsAuthContent";
+import { ViewGatewayIdentityAuthContent } from "./ViewGatewayIdentityAuthContent";
+
+type Props = {
+ authMethod: GatewayAuthMethodView;
+};
+
+export const ViewGatewayAuth = ({ authMethod }: Props) => {
+ if (authMethod.method === "aws") {
+ return <ViewGatewayAwsAuthContent config={authMethod.config} />;
+ }
+ if (authMethod.method === "token") {
+ return null;
+ }
+ return <ViewGatewayIdentityAuthContent config={authMethod.config} />;
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAwsAuthContent.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAwsAuthContent.tsx
new file mode 100644
index 0000000000..084da4bd51
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayAwsAuthContent.tsx
@@ -0,0 +1,45 @@
+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { GatewayAwsAuthConfig } from "@app/hooks/api/gateways-v2/types";
+
+const Field = ({
+ label,
+ children,
+ className
+}: {
+ label: string;
+ children: React.ReactNode;
+ className?: string;
+}) => (
+ <Detail className={className}>
+ <DetailLabel>{label}</DetailLabel>
+ <DetailValue>
+ {children ? <p className="break-words">{children}</p> : <p className="text-muted">—</p>}
+ </DetailValue>
+ </Detail>
+);
+
+type Props = {
+ config: GatewayAwsAuthConfig;
+};
+
+export const ViewGatewayAwsAuthContent = ({ config }: Props) => {
+ return (
+ <div className="grid grid-cols-1 gap-x-4 gap-y-2 md:grid-cols-2">
+ <Field label="Allowed Principal ARNs" className="md:col-span-2">
+ {config.allowedPrincipalArns
+ ?.split(",")
+ .map((a) => a.trim())
+ .join(", ")}
+ </Field>
+ <Field label="Allowed Account IDs" className="md:col-span-2">
+ {config.allowedAccountIds
+ ?.split(",")
+ .map((id) => id.trim())
+ .join(", ")}
+ </Field>
+ <Field label="STS Endpoint" className="md:col-span-2">
+ {config.stsEndpoint}
+ </Field>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayIdentityAuthContent.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayIdentityAuthContent.tsx
new file mode 100644
index 0000000000..646ce1b37e
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayAuthMethod/ViewGatewayIdentityAuthContent.tsx
@@ -0,0 +1,34 @@
+import { Link } from "@tanstack/react-router";
+import { ExternalLinkIcon } from "lucide-react";
+
+import { Detail, DetailLabel, DetailValue } from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import { GatewayIdentityAuthConfig } from "@app/hooks/api/gateways-v2/types";
+
+type Props = {
+ config: GatewayIdentityAuthConfig;
+};
+
+export const ViewGatewayIdentityAuthContent = ({ config }: Props) => {
+ const { currentOrg } = useOrganization();
+
+ return (
+ <Detail>
+ <DetailLabel>Machine Identity</DetailLabel>
+ <DetailValue>
+ {config.identityName ? (
+ <Link
+ to="/organizations/$orgId/identities/$identityId"
+ params={{ orgId: currentOrg.id, identityId: config.identityId }}
+ className="inline-flex items-center gap-1 underline"
+ >
+ {config.identityName}
+ <ExternalLinkIcon className="size-3.5 text-mineshaft-400" />
+ </Link>
+ ) : (
+ <span className="text-muted">Identity has been deleted</span>
+ )}
+ </DetailValue>
+ </Detail>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayConnectedResourcesSection/GatewayConnectedResourcesSection.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayConnectedResourcesSection/GatewayConnectedResourcesSection.tsx
new file mode 100644
index 0000000000..c1c36de065
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayConnectedResourcesSection/GatewayConnectedResourcesSection.tsx
@@ -0,0 +1,271 @@
+import { Link } from "@tanstack/react-router";
+import { ExternalLinkIcon } from "lucide-react";
+
+import { Spinner } from "@app/components/v2";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+ Badge,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
+ Item,
+ ItemContent,
+ ItemDescription,
+ ItemGroup,
+ ItemTitle
+} from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import {
+ TGatewayConnectedResources,
+ useGetGatewayConnectedResources
+} from "@app/hooks/api/gateways-v2";
+
+type Props = { gatewayId: string };
+
+const totalCountOf = (r: TGatewayConnectedResources | undefined) =>
+ r
+ ? r.appConnections.length +
+ r.dynamicSecrets.length +
+ r.pamResources.length +
+ r.pamDiscoverySources.length +
+ r.kubernetesAuths.length +
+ r.mcpServers.length +
+ r.pkiDiscoveryConfigs.length
+ : 0;
+
+const ResourceRow = ({
+ name,
+ subtitle,
+ to,
+ params
+}: {
+ name: string;
+ subtitle: string;
+ to: string;
+ params: Record<string, string>;
+}) => (
+ <Item asChild variant="outline" size="xs">
+ <Link to={to as "/"} params={params}>
+ <ItemContent>
+ <ItemTitle>{name}</ItemTitle>
+ <ItemDescription className="text-mineshaft-400">{subtitle}</ItemDescription>
+ </ItemContent>
+ <ExternalLinkIcon className="size-3.5 text-mineshaft-400" />
+ </Link>
+ </Item>
+);
+
+export const GatewayConnectedResourcesSection = ({ gatewayId }: Props) => {
+ const { currentOrg } = useOrganization();
+ const { data: resources, isPending } = useGetGatewayConnectedResources(gatewayId);
+
+ const total = totalCountOf(resources);
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>Connected Resources</CardTitle>
+ <CardDescription>Resources currently routing through this gateway</CardDescription>
+ </CardHeader>
+ <CardContent>
+ {isPending && (
+ <div className="flex h-32 items-center justify-center">
+ <Spinner size="lg" />
+ </div>
+ )}
+ {!isPending && total === 0 && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No connected resources</EmptyTitle>
+ <EmptyDescription>
+ Resources that route through this gateway will show up here.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isPending && total > 0 && (
+ <Accordion type="multiple">
+ {(resources?.appConnections.length ?? 0) > 0 && (
+ <AccordionItem value="app-connections">
+ <AccordionTrigger>
+ <span className="flex-1">App Connections</span>
+ <Badge variant="neutral">{resources?.appConnections.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.appConnections.map((c) => (
+ <ResourceRow
+ key={c.id}
+ name={c.name}
+ subtitle={
+ c.projectName ? `${c.app} · ${c.projectName}` : `${c.app} · Organization`
+ }
+ to="/organizations/$orgId/app-connections/"
+ params={{ orgId: currentOrg.id }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.dynamicSecrets.length ?? 0) > 0 && (
+ <AccordionItem value="dynamic-secrets">
+ <AccordionTrigger>
+ <span className="flex-1">Dynamic Secrets</span>
+ <Badge variant="neutral">{resources?.dynamicSecrets.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.dynamicSecrets.map((d) => (
+ <ResourceRow
+ key={d.id}
+ name={d.name}
+ subtitle={`${d.environmentSlug} · ${d.projectName}`}
+ to="/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug"
+ params={{
+ orgId: currentOrg.id,
+ projectId: d.projectId,
+ envSlug: d.environmentSlug
+ }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.pamResources.length ?? 0) > 0 && (
+ <AccordionItem value="pam-resources">
+ <AccordionTrigger>
+ <span className="flex-1">PAM Resources</span>
+ <Badge variant="neutral">{resources?.pamResources.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.pamResources.map((r) => (
+ <ResourceRow
+ key={r.id}
+ name={r.name}
+ subtitle={`${r.resourceType} · ${r.projectName}`}
+ to="/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId"
+ params={{
+ orgId: currentOrg.id,
+ projectId: r.projectId,
+ resourceType: r.resourceType,
+ resourceId: r.id
+ }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.pamDiscoverySources.length ?? 0) > 0 && (
+ <AccordionItem value="pam-discovery">
+ <AccordionTrigger>
+ <span className="flex-1">Discovery Sources</span>
+ <Badge variant="neutral">{resources?.pamDiscoverySources.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.pamDiscoverySources.map((s) => (
+ <ResourceRow
+ key={s.id}
+ name={s.name}
+ subtitle={`${s.discoveryType} · ${s.projectName}`}
+ to="/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId"
+ params={{
+ orgId: currentOrg.id,
+ projectId: s.projectId,
+ discoveryType: s.discoveryType,
+ discoverySourceId: s.id
+ }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.kubernetesAuths.length ?? 0) > 0 && (
+ <AccordionItem value="kubernetes-auth">
+ <AccordionTrigger>
+ <span className="flex-1">Kubernetes Auth</span>
+ <Badge variant="neutral">{resources?.kubernetesAuths.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.kubernetesAuths.map((a) => (
+ <ResourceRow
+ key={a.id}
+ name={a.identityName}
+ subtitle="Kubernetes Auth"
+ to="/organizations/$orgId/identities/$identityId"
+ params={{ orgId: currentOrg.id, identityId: a.identityId }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.mcpServers.length ?? 0) > 0 && (
+ <AccordionItem value="mcp-servers">
+ <AccordionTrigger>
+ <span className="flex-1">MCP Servers</span>
+ <Badge variant="neutral">{resources?.mcpServers.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.mcpServers.map((s) => (
+ <ResourceRow
+ key={s.id}
+ name={s.name}
+ subtitle={s.projectName}
+ to="/organizations/$orgId/projects/ai/$projectId/mcp-servers/$serverId"
+ params={{ orgId: currentOrg.id, projectId: s.projectId, serverId: s.id }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+
+ {(resources?.pkiDiscoveryConfigs.length ?? 0) > 0 && (
+ <AccordionItem value="pki-discovery">
+ <AccordionTrigger>
+ <span className="flex-1">PKI Discovery</span>
+ <Badge variant="neutral">{resources?.pkiDiscoveryConfigs.length}</Badge>
+ </AccordionTrigger>
+ <AccordionContent className="px-4 py-3">
+ <ItemGroup>
+ {resources?.pkiDiscoveryConfigs.map((c) => (
+ <ResourceRow
+ key={c.id}
+ name={c.name}
+ subtitle={c.projectName}
+ to="/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId"
+ params={{ orgId: currentOrg.id, projectId: c.projectId, discoveryId: c.id }}
+ />
+ ))}
+ </ItemGroup>
+ </AccordionContent>
+ </AccordionItem>
+ )}
+ </Accordion>
+ )}
+ </CardContent>
+ </Card>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx
new file mode 100644
index 0000000000..7423ccea3f
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDeploySection/GatewayDeploySection.tsx
@@ -0,0 +1,110 @@
+import { useState } from "react";
+import { RocketIcon } from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
+import {
+ Button,
+ Card,
+ CardAction,
+ CardDescription,
+ CardHeader,
+ CardTitle
+} from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
+import { useMintGatewayToken } from "@app/hooks/api/gateways-v2";
+import { GatewayAuthMethodView } from "@app/hooks/api/gateways-v2/types";
+
+import { AwsStartCommandDialog } from "../GatewayAuthMethod/AwsStartCommandDialog";
+import { EnrollmentTokenDialog } from "../GatewayAuthMethod/EnrollmentTokenDialog";
+
+type Props = {
+ gatewayId: string;
+ gatewayName: string;
+ authMethod: GatewayAuthMethodView;
+ // True when the gateway has no heartbeat — drives highlighting the start-command button.
+ isFirstTimeSetup: boolean;
+};
+
+export const GatewayDeploySection = ({
+ gatewayId,
+ gatewayName,
+ authMethod,
+ isFirstTimeSetup
+}: Props) => {
+ const { isSubOrganization } = useOrganization();
+ const [showAwsCommand, setShowAwsCommand] = useState(false);
+ const [enrollmentToken, setEnrollmentToken] = useState<string | null>(null);
+ const { mutateAsync: mint, isPending: isMinting } = useMintGatewayToken();
+
+ if (authMethod.method === "identity") return null;
+
+ const handleClick = async () => {
+ if (authMethod.method === "aws") {
+ setShowAwsCommand(true);
+ return;
+ }
+ try {
+ const result = await mint({ gatewayId });
+ setEnrollmentToken(result.token);
+ } catch {
+ createNotification({ type: "error", text: "Failed to generate enrollment token" });
+ }
+ };
+
+ return (
+ <>
+ <Card className="w-full">
+ <CardHeader>
+ <CardTitle>Deployment</CardTitle>
+ <CardDescription>Launch this gateway on a target host</CardDescription>
+ <CardAction>
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.EditGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => {
+ let variant: "neutral" | "org" | "sub-org" = "neutral";
+ if (isFirstTimeSetup) variant = isSubOrganization ? "sub-org" : "org";
+ return (
+ <Button
+ variant={variant}
+ size="sm"
+ isPending={isMinting}
+ isDisabled={!isAllowed || isMinting}
+ onClick={handleClick}
+ >
+ <RocketIcon className="size-4" />
+ Show deploy command
+ </Button>
+ );
+ }}
+ </OrgPermissionCan>
+ </CardAction>
+ </CardHeader>
+ </Card>
+
+ {authMethod.method === "aws" && (
+ <AwsStartCommandDialog
+ isOpen={showAwsCommand}
+ onOpenChange={setShowAwsCommand}
+ gatewayId={gatewayId}
+ gatewayName={gatewayName}
+ />
+ )}
+
+ {enrollmentToken && (
+ <EnrollmentTokenDialog
+ isOpen
+ onOpenChange={(open) => !open && setEnrollmentToken(null)}
+ gatewayName={gatewayName}
+ enrollmentToken={enrollmentToken}
+ />
+ )}
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx
new file mode 100644
index 0000000000..5426baa621
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayDetailsCard/GatewayDetailsCard.tsx
@@ -0,0 +1,183 @@
+import { useState } from "react";
+import { Link } from "@tanstack/react-router";
+import { format } from "date-fns";
+import { CheckIcon, ClipboardListIcon, PencilIcon, TriangleAlertIcon } from "lucide-react";
+
+import { OrgPermissionCan } from "@app/components/permissions";
+import { Tooltip } from "@app/components/v2";
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Badge,
+ Card,
+ CardContent,
+ CardHeader,
+ CardTitle,
+ Detail,
+ DetailGroup,
+ DetailGroupHeader,
+ DetailLabel,
+ DetailValue,
+ IconButton,
+ Separator
+} from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
+import { useTimedReset } from "@app/hooks";
+import {
+ GatewayAuthMethodView,
+ GatewayHealthCheckStatus,
+ TGatewayV2,
+ TGatewayV2WithAuthMethod
+} from "@app/hooks/api/gateways-v2/types";
+
+import { GatewayAuthMethodModal } from "../GatewayAuthMethod/GatewayAuthMethodModal";
+import { ViewGatewayAuth } from "../GatewayAuthMethod/ViewGatewayAuth";
+
+const HealthBadge = ({ gateway }: { gateway: TGatewayV2 }) => {
+ if (!gateway.heartbeat && !gateway.lastHealthCheckStatus) {
+ return <Badge variant="warning">Unregistered</Badge>;
+ }
+ if (gateway.lastHealthCheckStatus === GatewayHealthCheckStatus.Healthy) {
+ return <Badge variant="success">Healthy</Badge>;
+ }
+ return <Badge variant="danger">Unreachable</Badge>;
+};
+
+const AuthMethodBadge = ({ method }: { method: GatewayAuthMethodView["method"] }) => {
+ if (method === "aws") return <Badge variant="info">AWS Auth</Badge>;
+ if (method === "token") return <Badge variant="info">Token Auth</Badge>;
+ return <Badge variant="warning">Machine Identity</Badge>;
+};
+
+export const GatewayDetailsCard = ({ gateway }: { gateway: TGatewayV2WithAuthMethod }) => {
+ const [, isCopyingId, setCopyTextId] = useTimedReset<string>({
+ initialState: "Copy ID to clipboard"
+ });
+ const [authModalOpen, setAuthModalOpen] = useState(false);
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
+
+ const { authMethod } = gateway;
+ const isIdentityGateway = authMethod.method === "identity";
+
+ return (
+ <>
+ <Card className="w-full">
+ <CardHeader className="border-b">
+ <CardTitle>Details</CardTitle>
+ </CardHeader>
+ <CardContent>
+ <DetailGroup>
+ <DetailGroupHeader>General</DetailGroupHeader>
+ <Detail>
+ <DetailLabel>ID</DetailLabel>
+ <DetailValue className="flex items-center gap-x-1">
+ <span className="font-mono text-xs">{gateway.id}</span>
+ <Tooltip content="Copy gateway ID to clipboard">
+ <IconButton
+ aria-label="copy gateway id"
+ onClick={() => {
+ navigator.clipboard.writeText(gateway.id);
+ setCopyTextId("Copied");
+ }}
+ variant="ghost"
+ size="xs"
+ >
+ {isCopyingId ? <CheckIcon /> : <ClipboardListIcon className="text-label" />}
+ </IconButton>
+ </Tooltip>
+ </DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>Health</DetailLabel>
+ <DetailValue>
+ <HealthBadge gateway={gateway} />
+ </DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>Last Heartbeat</DetailLabel>
+ <DetailValue>
+ {gateway.heartbeat ? (
+ format(new Date(gateway.heartbeat), "PPpp")
+ ) : (
+ <span className="text-muted">—</span>
+ )}
+ </DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>Created</DetailLabel>
+ <DetailValue>{format(new Date(gateway.createdAt), "PPpp")}</DetailValue>
+ </Detail>
+ </DetailGroup>
+ <Separator className="my-4" />
+ <DetailGroup>
+ <DetailGroupHeader className="flex items-center justify-between">
+ Authentication
+ {!isIdentityGateway && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.EditGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <IconButton
+ size="xs"
+ variant="ghost-muted"
+ aria-label="edit auth method"
+ isDisabled={!isAllowed}
+ onClick={() => setAuthModalOpen(true)}
+ >
+ <PencilIcon />
+ </IconButton>
+ )}
+ </OrgPermissionCan>
+ )}
+ </DetailGroupHeader>
+ {isIdentityGateway && (
+ <Alert variant="warning">
+ <TriangleAlertIcon />
+ <AlertTitle>Authenticated via Machine Identity (Legacy)</AlertTitle>
+ <AlertDescription>
+ <p>
+ This gateway is still using machine identity. We recommend creating a new
+ gateway.
+ </p>
+ <Link
+ to="/organizations/$orgId/networking"
+ params={{ orgId }}
+ search={{ selectedTab: "gateways" }}
+ className="underline underline-offset-4"
+ >
+ Create a new gateway
+ </Link>
+ </AlertDescription>
+ </Alert>
+ )}
+ {!isIdentityGateway && (
+ <Detail>
+ <DetailLabel>Method</DetailLabel>
+ <DetailValue>
+ <AuthMethodBadge method={authMethod.method} />
+ </DetailValue>
+ </Detail>
+ )}
+ <ViewGatewayAuth authMethod={authMethod} />
+ </DetailGroup>
+ </CardContent>
+ </Card>
+
+ {!isIdentityGateway && (
+ <GatewayAuthMethodModal
+ isOpen={authModalOpen}
+ onOpenChange={setAuthModalOpen}
+ gatewayId={gateway.id}
+ currentMethod={authMethod}
+ />
+ )}
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx
new file mode 100644
index 0000000000..9fb8df1779
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/components/GatewayPageHeader/GatewayPageHeader.tsx
@@ -0,0 +1,149 @@
+import { useNavigate } from "@tanstack/react-router";
+import { BanIcon, CopyIcon, EllipsisIcon, HeartPulseIcon, TrashIcon } from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { OrgPermissionCan } from "@app/components/permissions";
+import { DeleteActionModal, PageHeader } from "@app/components/v2";
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger
+} from "@app/components/v3";
+import {
+ OrgGatewayPermissionActions,
+ OrgPermissionSubjects
+} from "@app/context/OrgPermissionContext/types";
+import { usePopUp } from "@app/hooks";
+import {
+ useDeleteGatewayV2ById,
+ useRevokeGatewayAccess,
+ useTriggerGatewayV2Heartbeat
+} from "@app/hooks/api/gateways-v2";
+import { TGatewayV2 } from "@app/hooks/api/gateways-v2/types";
+
+export const GatewayPageHeader = ({ gateway, orgId }: { gateway: TGatewayV2; orgId: string }) => {
+ const navigate = useNavigate();
+ const { mutateAsync: deleteGateway } = useDeleteGatewayV2ById();
+ const { mutateAsync: revokeGateway } = useRevokeGatewayAccess();
+ const { mutateAsync: triggerHeartbeat, isPending: isHeartbeating } =
+ useTriggerGatewayV2Heartbeat();
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
+ "deleteGateway",
+ "revokeGateway"
+ ] as const);
+
+ const onDelete = async () => {
+ await deleteGateway(gateway.id);
+ createNotification({ type: "success", text: "Successfully deleted gateway" });
+ navigate({ to: "/organizations/$orgId/networking", params: { orgId } });
+ };
+
+ const onRevoke = async () => {
+ try {
+ await revokeGateway({ gatewayId: gateway.id });
+ createNotification({ type: "success", text: "Gateway access revoked" });
+ handlePopUpToggle("revokeGateway", false);
+ } catch {
+ createNotification({ type: "error", text: "Failed to revoke gateway access" });
+ }
+ };
+
+ const onHeartbeat = async () => {
+ try {
+ await triggerHeartbeat(gateway.id);
+ createNotification({ type: "success", text: "Health check successful — gateway is healthy" });
+ } catch {
+ createNotification({ type: "error", text: "Health check failed — gateway is unreachable" });
+ }
+ };
+
+ const isRegistered = Boolean(gateway.heartbeat || gateway.lastHealthCheckStatus);
+ const { canRevoke } = gateway;
+
+ return (
+ <>
+ <PageHeader
+ scope="org"
+ title={gateway.name}
+ description="Gateway configuration and authentication"
+ >
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline">
+ Options
+ <EllipsisIcon />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem
+ onClick={() => {
+ navigator.clipboard.writeText(gateway.id);
+ createNotification({ type: "info", text: "Gateway ID copied to clipboard" });
+ }}
+ >
+ <CopyIcon />
+ Copy Gateway ID
+ </DropdownMenuItem>
+ {isRegistered && (
+ <DropdownMenuItem isDisabled={isHeartbeating} onClick={onHeartbeat}>
+ <HeartPulseIcon />
+ Trigger Health Check
+ </DropdownMenuItem>
+ )}
+ {canRevoke && (
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.RevokeGatewayAccess}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("revokeGateway")}
+ >
+ <BanIcon />
+ Revoke Access
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ )}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.DeleteGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ variant="danger"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("deleteGateway")}
+ >
+ <TrashIcon />
+ Delete Gateway
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </PageHeader>
+
+ <DeleteActionModal
+ isOpen={popUp.deleteGateway.isOpen}
+ title={`Delete gateway "${gateway.name}"?`}
+ onChange={(isOpen) => handlePopUpToggle("deleteGateway", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={onDelete}
+ />
+ <DeleteActionModal
+ isOpen={popUp.revokeGateway.isOpen}
+ title={`Revoke access for gateway "${gateway.name}"?`}
+ subTitle="The gateway will be disconnected and any active tokens will be invalidated. The gateway will need to re-authenticate to reconnect."
+ onChange={(isOpen) => handlePopUpToggle("revokeGateway", isOpen)}
+ deleteKey="confirm"
+ buttonText="Revoke access"
+ onDeleteApproved={onRevoke}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/route.tsx b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/route.tsx
new file mode 100644
index 0000000000..29860cf28c
--- /dev/null
+++ b/frontend/src/pages/organization/NetworkingPage/GatewayDetailsByIDPage/route.tsx
@@ -0,0 +1,20 @@
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { GatewayDetailsByIDPage } from "./GatewayDetailsByIDPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId"
+)({
+ component: GatewayDetailsByIDPage,
+ context: ({ params }) => ({
+ breadcrumbs: [
+ {
+ label: "Networking",
+ link: linkOptions({ to: "/organizations/$orgId/networking" as const, params })
+ },
+ {
+ label: "Gateways"
+ }
+ ]
+ })
+});
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
index 92d678dd47..4c57a9c15f 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
@@ -1,6 +1,5 @@
import { useState } from "react";
import {
- faArrowsRotate,
faCopy,
faDoorClosed,
faEdit,
@@ -14,6 +13,7 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useQuery } from "@tanstack/react-query";
+import { useNavigate } from "@tanstack/react-router";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
@@ -40,6 +40,7 @@ import {
Tr
} from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3";
+import { useOrganization } from "@app/context";
import {
OrgGatewayPermissionActions,
OrgGatewayPoolPermissionActions,
@@ -54,52 +55,21 @@ import { useDeleteGatewayV2ById, useTriggerGatewayV2Heartbeat } from "@app/hooks
import { CreateGatewayPoolModal } from "./components/CreateGatewayPoolModal";
import { EditGatewayDetailsModal } from "./components/EditGatewayDetailsModal";
-import { GatewayConnectedResourcesDrawer } from "./components/GatewayConnectedResourcesDrawer";
import { GatewayDeployModal } from "./components/GatewayDeployModal";
import { GatewayHealthStatus } from "./components/GatewayHealthStatus";
import { GatewayPoolsContent } from "./components/GatewayPoolsContent";
-import { ReEnrollGatewayModal } from "./components/ReEnrollGatewayModal";
-
-type GatewayConnectedCellProps = {
- isV1: boolean;
- connectedResourcesCount: number;
- onClick: () => void;
-};
-
-const GatewayConnectedCell = ({
- isV1,
- connectedResourcesCount,
- onClick
-}: GatewayConnectedCellProps) => {
- if (isV1 || connectedResourcesCount === 0) {
- return <span className="text-mineshaft-400">—</span>;
- }
-
- return (
- <button
- type="button"
- onClick={onClick}
- className="flex cursor-pointer items-center gap-1.5 text-mineshaft-200 underline decoration-mineshaft-400 underline-offset-2 hover:text-mineshaft-100 hover:decoration-mineshaft-300"
- >
- <span>
- {connectedResourcesCount} resource{connectedResourcesCount !== 1 ? "s" : ""}
- </span>
- </button>
- );
-};
export const GatewayTab = withPermission(
() => {
+ const navigate = useNavigate();
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
const [activeSubTab, setActiveSubTab] = useState<"all-gateways" | "gateway-pools">(
"all-gateways"
);
const { subscription } = useSubscription();
const showPoolsTab = subscription?.gatewayPool;
const [search, setSearch] = useState("");
- const [selectedGateway, setSelectedGateway] = useState<{
- id: string;
- name: string;
- } | null>(null);
const { data: gateways, isPending: isGatewaysLoading } = useQuery({
...gatewaysQueryKeys.listWithTokens(),
refetchInterval: 15_000
@@ -122,8 +92,6 @@ export const GatewayTab = withPermission(
"deployGateway",
"deleteGateway",
"editDetails",
- "connectedResources",
- "reEnrollGateway",
"createPool"
] as const);
@@ -139,29 +107,19 @@ export const GatewayTab = withPermission(
text: "Health check successful - gateway is healthy"
});
} catch {
- createNotification({
- type: "error",
- text: "Health check failed - gateway is unreachable"
- });
+ createNotification({ type: "error", text: "Health check failed - gateway is unreachable" });
}
};
const handleDeleteGateway = async () => {
- const data = popUp.deleteGateway.data as {
- id: string;
- isV1: boolean;
- };
+ const data = popUp.deleteGateway.data as { id: string; isV1: boolean };
if (data.isV1) {
await deleteGatewayById.mutateAsync(data.id);
} else {
await deleteGatewayV2ById.mutateAsync(data.id);
}
-
handlePopUpToggle("deleteGateway");
- createNotification({
- type: "success",
- text: "Successfully deleted gateway"
- });
+ createNotification({ type: "success", text: "Successfully deleted gateway" });
};
const filteredGateway = gateways?.filter((el) =>
@@ -279,131 +237,106 @@ export const GatewayTab = withPermission(
</THead>
<TBody>
{isGatewaysLoading && (
- <TableSkeleton innerKey="gateway-table" columns={5} key="gateway-table" />
+ <TableSkeleton
+ innerKey="gateway-table"
+ columns={showPoolsTab ? 5 : 4}
+ key="gateway-table"
+ />
)}
- {filteredGateway?.map((el) => (
- <Tr key={el.id}>
- <Td>
- <div className="flex items-center gap-2">
- <span>{el.name}</span>
- {(() => {
- if ("isExpired" in el && el.isExpired) {
- return (
- <span className="rounded-sm bg-red-900/30 px-1.5 py-0.5 text-xs text-red-400">
- Expired
- </span>
- );
- }
- if (el.isPending) {
- return (
- <span className="rounded-sm bg-yellow-900/30 px-1.5 py-0.5 text-xs text-yellow-500">
- Pending
- </span>
- );
- }
- return (
- <span className="rounded-sm bg-mineshaft-700 px-1.5 py-0.5 text-xs text-mineshaft-400">
- Gateway v{el.isV1 ? "1" : "2"}
- </span>
- );
- })()}
- {"hasReEnrollToken" in el && el.hasReEnrollToken && (
- <span className="rounded-sm bg-yellow-900/30 px-1.5 py-0.5 text-xs text-yellow-500">
- Re-enrolling
+ {filteredGateway?.map((el) => {
+ const canNavigate = !el.isV1;
+ return (
+ <Tr
+ key={el.id}
+ className={
+ canNavigate ? "cursor-pointer hover:bg-mineshaft-700" : undefined
+ }
+ onClick={
+ canNavigate
+ ? () =>
+ navigate({
+ to: "/organizations/$orgId/networking/gateways/$gatewayId",
+ params: { orgId, gatewayId: el.id }
+ })
+ : undefined
+ }
+ >
+ <Td>
+ <div className="flex items-center gap-2">
+ <span>{el.name}</span>
+ <span className="rounded-sm bg-mineshaft-700 px-1.5 py-0.5 text-xs text-mineshaft-400">
+ Gateway v{el.isV1 ? "1" : "2"}
</span>
- )}
- </div>
- </Td>
- {showPoolsTab && (
+ </div>
+ </Td>
+ {showPoolsTab && (
+ <Td>
+ {(gatewayPoolMap.get(el.id) ?? []).length > 0 ? (
+ <div className="flex flex-wrap gap-1">
+ {(gatewayPoolMap.get(el.id) ?? []).map((poolName) => (
+ <span
+ key={poolName}
+ className="rounded-sm bg-info/15 px-1.5 py-0.5 text-xs text-info"
+ >
+ {poolName}
+ </span>
+ ))}
+ </div>
+ ) : (
+ <span className="text-mineshaft-400">&mdash;</span>
+ )}
+ </Td>
+ )}
<Td>
- {(gatewayPoolMap.get(el.id) ?? []).length > 0 ? (
- <div className="flex flex-wrap gap-1">
- {(gatewayPoolMap.get(el.id) ?? []).map((poolName) => (
- <span
- key={poolName}
- className="rounded-sm bg-info/15 px-1.5 py-0.5 text-xs text-info"
- >
- {poolName}
- </span>
- ))}
- </div>
+ {!el.isV1 && el.connectedResourcesCount > 0 ? (
+ <span className="text-mineshaft-200">
+ {el.connectedResourcesCount} resource
+ {el.connectedResourcesCount !== 1 ? "s" : ""}
+ </span>
) : (
- <span className="text-mineshaft-400">&mdash;</span>
+ <span className="text-mineshaft-400">—</span>
)}
</Td>
- )}
- <Td>
- {el.isPending ? (
- <span className="text-mineshaft-400">—</span>
- ) : (
- <GatewayConnectedCell
- isV1={el.isV1}
- connectedResourcesCount={
- "connectedResourcesCount" in el ? el.connectedResourcesCount : 0
+ <Td>
+ <GatewayHealthStatus
+ heartbeat={"heartbeat" in el ? el.heartbeat : null}
+ lastHealthCheckStatus={
+ "lastHealthCheckStatus" in el ? el.lastHealthCheckStatus : null
}
- onClick={() => {
- setSelectedGateway({ id: el.id, name: el.name });
- handlePopUpOpen("connectedResources");
- }}
/>
- )}
- </Td>
- <Td>
- <GatewayHealthStatus
- heartbeat={"heartbeat" in el ? el.heartbeat : null}
- lastHealthCheckStatus={
- "lastHealthCheckStatus" in el ? el.lastHealthCheckStatus : null
- }
- isPending={el.isPending}
- isExpired={"isExpired" in el ? (el.isExpired as boolean) : false}
- />
- </Td>
- <Td className="w-5">
- <Tooltip className="max-w-sm text-center" content="Options">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- ariaLabel="Options"
- colorSchema="secondary"
- className="w-6"
- variant="plain"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem
- icon={<FontAwesomeIcon icon={faCopy} />}
- onClick={() => navigator.clipboard.writeText(el.id)}
- >
- Copy ID
- </DropdownMenuItem>
- {!el.isV1 && !el.isPending && (
+ </Td>
+ <Td className="w-5" onClick={(e) => e.stopPropagation()}>
+ <Tooltip className="max-w-sm text-center" content="Options">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ ariaLabel="Options"
+ colorSchema="secondary"
+ className="w-6"
+ variant="plain"
+ >
+ <FontAwesomeIcon icon={faEllipsisV} />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
<DropdownMenuItem
- icon={<FontAwesomeIcon icon={faHeartPulse} />}
- onClick={() => handleTriggerHealthCheck(el.id)}
+ icon={<FontAwesomeIcon icon={faCopy} />}
+ onClick={() => navigator.clipboard.writeText(el.id)}
>
- Trigger Health Check
+ Copy ID
</DropdownMenuItem>
- )}
- {el.isV1 && (
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.EditGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed: boolean) => (
+ {!el.isV1 &&
+ ("heartbeat" in el
+ ? !!el.heartbeat || !!el.lastHealthCheckStatus
+ : false) && (
<DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faEdit} />}
- onClick={() => handlePopUpOpen("editDetails", el)}
+ icon={<FontAwesomeIcon icon={faHeartPulse} />}
+ onClick={() => handleTriggerHealthCheck(el.id)}
>
- Edit Details
+ Trigger Health Check
</DropdownMenuItem>
)}
- </OrgPermissionCan>
- )}
- {!el.isV1 &&
- (el.isPending || ("identityId" in el && !el.identityId)) && (
+ {el.isV1 && (
<OrgPermissionCan
I={OrgGatewayPermissionActions.EditGateways}
a={OrgPermissionSubjects.Gateway}
@@ -411,35 +344,36 @@ export const GatewayTab = withPermission(
{(isAllowed: boolean) => (
<DropdownMenuItem
isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faArrowsRotate} />}
- onClick={() => handlePopUpOpen("reEnrollGateway", el)}
+ icon={<FontAwesomeIcon icon={faEdit} />}
+ onClick={() => handlePopUpOpen("editDetails", el)}
>
- Re-enroll
+ Edit Details
</DropdownMenuItem>
)}
</OrgPermissionCan>
)}
- <OrgPermissionCan
- I={OrgGatewayPermissionActions.DeleteGateways}
- a={OrgPermissionSubjects.Gateway}
- >
- {(isAllowed: boolean) => (
- <DropdownMenuItem
- isDisabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
- className="text-red"
- onClick={() => handlePopUpOpen("deleteGateway", el)}
- >
- Delete Gateway
- </DropdownMenuItem>
- )}
- </OrgPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </Tooltip>
- </Td>
- </Tr>
- ))}
+ <OrgPermissionCan
+ I={OrgGatewayPermissionActions.DeleteGateways}
+ a={OrgPermissionSubjects.Gateway}
+ >
+ {(isAllowed: boolean) => (
+ <DropdownMenuItem
+ isDisabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ className="text-red"
+ onClick={() => handlePopUpOpen("deleteGateway", el)}
+ >
+ Delete Gateway
+ </DropdownMenuItem>
+ )}
+ </OrgPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </Tooltip>
+ </Td>
+ </Tr>
+ );
+ })}
</TBody>
</Table>
<Modal
@@ -474,28 +408,6 @@ export const GatewayTab = withPermission(
isOpen={popUp.deployGateway.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("deployGateway", isOpen)}
/>
- <ReEnrollGatewayModal
- isOpen={popUp.reEnrollGateway.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("reEnrollGateway", isOpen)}
- gatewayData={
- popUp.reEnrollGateway.data as {
- id: string;
- name: string;
- isPending: boolean;
- } | null
- }
- />
- {selectedGateway && (
- <GatewayConnectedResourcesDrawer
- isOpen={popUp.connectedResources.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("connectedResources", isOpen);
- if (!isOpen) setSelectedGateway(null);
- }}
- gatewayId={selectedGateway.id}
- gatewayName={selectedGateway.name}
- />
- )}
</TableContainer>
</div>
</>
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayConnectedResourcesDrawer.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayConnectedResourcesDrawer.tsx
deleted file mode 100644
index acb60b3f49..0000000000
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayConnectedResourcesDrawer.tsx
+++ /dev/null
@@ -1,321 +0,0 @@
-import { Link } from "@tanstack/react-router";
-import { ExternalLinkIcon } from "lucide-react";
-
-import { Spinner } from "@app/components/v2";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
- Badge,
- Sheet,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle
-} from "@app/components/v3";
-import { useOrganization } from "@app/context";
-import {
- TGatewayConnectedResources,
- useGetGatewayConnectedResources
-} from "@app/hooks/api/gateways-v2";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- gatewayId: string;
- gatewayName: string;
-};
-
-const getTotalResourceCount = (resources: TGatewayConnectedResources | undefined): number => {
- if (!resources) return 0;
- return (
- resources.appConnections.length +
- resources.dynamicSecrets.length +
- resources.pamResources.length +
- resources.pamDiscoverySources.length +
- resources.kubernetesAuths.length +
- resources.mcpServers.length +
- resources.pkiDiscoveryConfigs.length
- );
-};
-
-const getResourceTypeCount = (resources: TGatewayConnectedResources | undefined): number => {
- if (!resources) return 0;
- let count = 0;
- if (resources.appConnections.length > 0) count += 1;
- if (resources.dynamicSecrets.length > 0) count += 1;
- if (resources.pamResources.length > 0) count += 1;
- if (resources.pamDiscoverySources.length > 0) count += 1;
- if (resources.kubernetesAuths.length > 0) count += 1;
- if (resources.mcpServers.length > 0) count += 1;
- if (resources.pkiDiscoveryConfigs.length > 0) count += 1;
- return count;
-};
-
-type ResourceRowProps = {
- name: string;
- subtitle: string;
- to: string;
- params: Record<string, string>;
- isLast?: boolean;
-};
-
-const ResourceRow = ({ name, subtitle, to, params, isLast }: ResourceRowProps) => {
- return (
- <Link
- to={to as "/"}
- params={params}
- className={`flex items-center justify-between px-4 py-2.5 transition-colors hover:bg-mineshaft-700/30 ${
- !isLast ? "border-b border-mineshaft-600" : ""
- }`}
- >
- <div className="flex flex-col gap-0.5">
- <span className="text-sm text-mineshaft-100">{name}</span>
- <span className="text-xs text-mineshaft-400">{subtitle}</span>
- </div>
- <ExternalLinkIcon className="size-3.5 text-mineshaft-400" />
- </Link>
- );
-};
-
-export const GatewayConnectedResourcesDrawer = ({
- isOpen,
- onOpenChange,
- gatewayId,
- gatewayName
-}: Props) => {
- const { currentOrg } = useOrganization();
- const { data: resources, isPending } = useGetGatewayConnectedResources(isOpen ? gatewayId : "");
-
- const totalCount = getTotalResourceCount(resources);
- const typeCount = getResourceTypeCount(resources);
-
- const defaultOpenSections = [
- resources?.appConnections.length ? "app-connections" : null,
- resources?.dynamicSecrets.length ? "dynamic-secrets" : null,
- resources?.pamResources.length ? "pam-resources" : null,
- resources?.pamDiscoverySources.length ? "pam-discovery" : null,
- resources?.kubernetesAuths.length ? "kubernetes-auth" : null,
- resources?.mcpServers.length ? "mcp-servers" : null,
- resources?.pkiDiscoveryConfigs.length ? "pki-discovery" : null
- ].filter(Boolean) as string[];
-
- return (
- <Sheet open={isOpen} onOpenChange={onOpenChange}>
- <SheetContent className="overflow-y-auto">
- <SheetHeader className="border-b border-mineshaft-600">
- <SheetTitle>Connected Resources</SheetTitle>
- <SheetDescription>{gatewayName}</SheetDescription>
- </SheetHeader>
-
- <div className="flex-1 px-4">
- {isPending ? (
- <div className="flex h-32 items-center justify-center">
- <Spinner size="lg" />
- </div>
- ) : (
- <div className="flex flex-col gap-4">
- <p className="text-sm text-mineshaft-300">
- {totalCount > 0 ? (
- <>
- {totalCount} resource{totalCount !== 1 ? "s" : ""} connected across {typeCount}{" "}
- type{typeCount !== 1 ? "s" : ""}
- </>
- ) : (
- "No resources connected to this gateway"
- )}
- </p>
-
- {totalCount > 0 && (
- <Accordion type="multiple" defaultValue={defaultOpenSections}>
- {(resources?.appConnections.length ?? 0) > 0 && (
- <AccordionItem value="app-connections">
- <AccordionTrigger>
- <span className="flex-1">App Connections</span>
- <Badge variant="neutral">{resources?.appConnections.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.appConnections.map((conn, idx) => (
- <ResourceRow
- key={conn.id}
- name={conn.name}
- subtitle={
- conn.projectName
- ? `${conn.app} · ${conn.projectName}`
- : `${conn.app} · Organization`
- }
- to="/organizations/$orgId/app-connections/"
- params={{ orgId: currentOrg.id }}
- isLast={idx === (resources?.appConnections.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.dynamicSecrets.length ?? 0) > 0 && (
- <AccordionItem value="dynamic-secrets">
- <AccordionTrigger>
- <span className="flex-1">Dynamic Secrets</span>
- <Badge variant="neutral">{resources?.dynamicSecrets.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.dynamicSecrets.map((ds, idx) => (
- <ResourceRow
- key={ds.id}
- name={ds.name}
- subtitle={`${ds.environmentSlug} · ${ds.projectName}`}
- to="/organizations/$orgId/projects/secret-management/$projectId/secrets/$envSlug"
- params={{
- orgId: currentOrg.id,
- projectId: ds.projectId,
- envSlug: ds.environmentSlug
- }}
- isLast={idx === (resources?.dynamicSecrets.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.pamResources.length ?? 0) > 0 && (
- <AccordionItem value="pam-resources">
- <AccordionTrigger>
- <span className="flex-1">PAM Resources</span>
- <Badge variant="neutral">{resources?.pamResources.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.pamResources.map((res, idx) => (
- <ResourceRow
- key={res.id}
- name={res.name}
- subtitle={`${res.resourceType} · ${res.projectName}`}
- to="/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId"
- params={{
- orgId: currentOrg.id,
- projectId: res.projectId,
- resourceType: res.resourceType,
- resourceId: res.id
- }}
- isLast={idx === (resources?.pamResources.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.pamDiscoverySources.length ?? 0) > 0 && (
- <AccordionItem value="pam-discovery">
- <AccordionTrigger>
- <span className="flex-1">Discovery Sources</span>
- <Badge variant="neutral">{resources?.pamDiscoverySources.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.pamDiscoverySources.map((source, idx) => (
- <ResourceRow
- key={source.id}
- name={source.name}
- subtitle={`${source.discoveryType} · ${source.projectName}`}
- to="/organizations/$orgId/projects/pam/$projectId/discovery/$discoveryType/$discoverySourceId"
- params={{
- orgId: currentOrg.id,
- projectId: source.projectId,
- discoveryType: source.discoveryType,
- discoverySourceId: source.id
- }}
- isLast={idx === (resources?.pamDiscoverySources.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.kubernetesAuths.length ?? 0) > 0 && (
- <AccordionItem value="kubernetes-auth">
- <AccordionTrigger>
- <span className="flex-1">Kubernetes Auth</span>
- <Badge variant="neutral">{resources?.kubernetesAuths.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.kubernetesAuths.map((auth, idx) => (
- <ResourceRow
- key={auth.id}
- name={auth.identityName}
- subtitle="Kubernetes Auth"
- to="/organizations/$orgId/identities/$identityId"
- params={{ orgId: currentOrg.id, identityId: auth.identityId }}
- isLast={idx === (resources?.kubernetesAuths.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.mcpServers.length ?? 0) > 0 && (
- <AccordionItem value="mcp-servers">
- <AccordionTrigger>
- <span className="flex-1">MCP Servers</span>
- <Badge variant="neutral">{resources?.mcpServers.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.mcpServers.map((server, idx) => (
- <ResourceRow
- key={server.id}
- name={server.name}
- subtitle={server.projectName}
- to="/organizations/$orgId/projects/ai/$projectId/mcp-servers/$serverId"
- params={{
- orgId: currentOrg.id,
- projectId: server.projectId,
- serverId: server.id
- }}
- isLast={idx === (resources?.mcpServers.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
-
- {(resources?.pkiDiscoveryConfigs.length ?? 0) > 0 && (
- <AccordionItem value="pki-discovery">
- <AccordionTrigger>
- <span className="flex-1">PKI Discovery</span>
- <Badge variant="neutral">{resources?.pkiDiscoveryConfigs.length}</Badge>
- </AccordionTrigger>
- <AccordionContent className="p-0">
- {resources?.pkiDiscoveryConfigs.map((config, idx) => (
- <ResourceRow
- key={config.id}
- name={config.name}
- subtitle={config.projectName}
- to="/organizations/$orgId/projects/cert-manager/$projectId/discovery/$discoveryId"
- params={{
- orgId: currentOrg.id,
- projectId: config.projectId,
- discoveryId: config.id
- }}
- isLast={idx === (resources?.pkiDiscoveryConfigs.length ?? 0) - 1}
- />
- ))}
- </AccordionContent>
- </AccordionItem>
- )}
- </Accordion>
- )}
- </div>
- )}
- </div>
-
- {totalCount > 0 && (
- <SheetFooter>
- <p className="text-xs text-mineshaft-400">
- To delete this gateway, first remove or reassign these connected resources.
- </p>
- </SheetFooter>
- )}
- </SheetContent>
- </Sheet>
- );
-};
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayDeployModal.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayDeployModal.tsx
index c037b6144e..b6d023c938 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayDeployModal.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayDeployModal.tsx
@@ -1,245 +1,89 @@
-import { useMemo, useState } from "react";
-import { SingleValue } from "react-select";
-import { faCopy, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Controller, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import {
- Button,
- FilterableSelect,
- FormLabel,
- IconButton,
- Input,
- Modal,
- ModalClose,
- ModalContent,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from "@app/components/v2";
+import { Button, FormControl, Input, Modal, ModalClose, ModalContent } from "@app/components/v2";
import { ROUTE_PATHS } from "@app/const/routes";
+import { useOrganization } from "@app/context";
import { gatewaysQueryKeys } from "@app/hooks/api/gateways";
-import { useConfigureGatewayTokenAuth, useCreateGateway } from "@app/hooks/api/gateways-v2";
-import { useGetRelays } from "@app/hooks/api/relays/queries";
+import { useCreateGateway } from "@app/hooks/api/gateways-v2";
import { slugSchema } from "@app/lib/schemas";
-import { RelayOption } from "./RelayOption";
-
const formSchema = z.object({
- name: slugSchema({ field: "name" }),
- relay: z
- .object({ id: z.string(), name: z.string() }, { required_error: "Relay is required" })
- .nullable()
- .refine((val) => val !== null, { message: "Relay is required" })
+ name: slugSchema({ field: "name" })
});
+type FormData = z.infer<typeof formSchema>;
+
type Props = {
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
};
-const Content = () => {
- const { protocol, hostname, port } = window.location;
- const portSuffix = port && port !== "80" ? `:${port}` : "";
- const siteURL = `${protocol}//${hostname}${portSuffix}`;
-
+const Content = ({ onClose }: { onClose: () => void }) => {
+ const { currentOrg } = useOrganization();
+ const orgId = currentOrg?.id || "";
const navigate = useNavigate({ from: ROUTE_PATHS.Organization.NetworkingPage.path });
-
- const [step, setStep] = useState<"form" | "command">("form");
- const [name, setName] = useState("");
- const [relay, setRelay] = useState<null | { id: string; name: string }>({
- id: "_auto",
- name: "Auto Select Relay"
- });
- const [enrollmentToken, setEnrollmentToken] = useState("");
- const [resolvedRelayName, setResolvedRelayName] = useState("");
- const [formErrors, setFormErrors] = useState<z.ZodIssue[]>([]);
-
- const errors = useMemo(() => {
- const errorMap: Record<string, string | undefined> = {};
- formErrors.forEach((issue) => {
- if (issue.path.length > 0) errorMap[String(issue.path[0])] = issue.message;
- });
- return errorMap;
- }, [formErrors]);
-
const { data: gateways } = useQuery(gatewaysQueryKeys.listWithTokens());
- const { data: relays, isPending: isRelaysLoading } = useGetRelays();
- const { mutateAsync: createGateway, isPending: isCreatingGateway } = useCreateGateway();
- const { mutateAsync: configureTokenAuth, isPending: isConfiguringToken } =
- useConfigureGatewayTokenAuth();
-
- const handleContinue = async () => {
- setFormErrors([]);
- const validation = formSchema.safeParse({ name, relay });
- if (!validation.success) {
- setFormErrors(validation.error.issues);
- return;
- }
+ const { mutateAsync: createGateway, isPending } = useCreateGateway();
+
+ const {
+ control,
+ handleSubmit,
+ formState: { isSubmitting }
+ } = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: { name: "" }
+ });
- const existingNames = gateways?.map((g) => g.name) || [];
+ const onSubmit = async ({ name }: FormData) => {
+ const existingNames = gateways?.map((g) => g.name) ?? [];
if (existingNames.includes(name.trim())) {
- createNotification({
- type: "error",
- text: "A gateway with this name already exists."
- });
+ createNotification({ type: "error", text: "A gateway with this name already exists." });
return;
}
try {
- const gateway = await createGateway({ name });
- const tokenResult = await configureTokenAuth({ gatewayId: gateway.id });
- setEnrollmentToken(tokenResult.token);
-
- const relayName = relay?.id === "_auto" ? "" : (relay?.name ?? "");
- setResolvedRelayName(relayName);
- setStep("command");
+ const gateway = await createGateway({ name, authMethod: { method: "token" } });
+ onClose();
+ navigate({
+ to: "/organizations/$orgId/networking/gateways/$gatewayId" as const,
+ params: { orgId, gatewayId: gateway.id }
+ });
} catch {
createNotification({ type: "error", text: "Failed to create gateway" });
}
};
- const cliCommand = useMemo(() => {
- const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
- return `infisical gateway start ${name} --enroll-method=token --token=${enrollmentToken}${relayPart} --domain=${siteURL}`;
- }, [name, enrollmentToken, resolvedRelayName, siteURL]);
-
- const systemdInstallCommand = useMemo(() => {
- const relayPart = resolvedRelayName ? ` --target-relay-name=${resolvedRelayName}` : "";
- return `sudo infisical gateway systemd install ${name} --enroll-method=token --token=${enrollmentToken}${relayPart} --domain=${siteURL}`;
- }, [name, enrollmentToken, resolvedRelayName, siteURL]);
-
- const startServiceCommand = "sudo systemctl start infisical-gateway";
-
- const copyToClipboard = (text: string, label: string) => {
- navigator.clipboard.writeText(text);
- createNotification({ text: `${label} copied to clipboard`, type: "info" });
- };
-
- if (step === "command") {
- return (
- <>
- <p className="mb-3 text-sm text-mineshaft-300">
- Run the following command on the machine where you want to deploy the gateway. The token
- expires in 1 hour and can only be used once.
- </p>
- <Tabs defaultValue="cli" className="mt-2">
- <TabList>
- <Tab value="cli">CLI</Tab>
- <Tab value="systemd">CLI (systemd)</Tab>
- </TabList>
- <TabPanel value="cli">
- <div className="flex gap-2">
- <Input value={cliCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(cliCommand, "Command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- </TabPanel>
- <TabPanel value="systemd">
- <FormLabel label="Installation Command" />
- <div className="flex gap-2">
- <Input value={systemdInstallCommand} isDisabled />
- <IconButton
- ariaLabel="copy install command"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(systemdInstallCommand, "Installation command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- <FormLabel label="Start the Gateway Service" className="mt-4" />
- <div className="flex gap-2">
- <Input value={startServiceCommand} isDisabled />
- <IconButton
- ariaLabel="copy start command"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(startServiceCommand, "Start command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- </TabPanel>
- </Tabs>
- <a
- href="https://infisical.com/docs/cli/overview"
- target="_blank"
- className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors duration-100 hover:border-yellow-400 hover:text-yellow-400"
- rel="noreferrer"
- >
- <span>Install the Infisical CLI</span>
- <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />
- </a>
- <div className="mt-6 flex items-center">
- <ModalClose asChild>
- <Button className="mr-4" size="sm" colorSchema="secondary">
- Done
- </Button>
- </ModalClose>
- </div>
- </>
- );
- }
-
return (
- <>
- <FormLabel label="Name" tooltipText="The name for your gateway." />
- <Input
- value={name}
- onChange={(e) => setName(e.target.value)}
- placeholder="Enter gateway name..."
- isError={Boolean(errors.name)}
- />
- {errors.name && <p className="mt-1 text-sm text-red">{errors.name}</p>}
-
- <FormLabel label="Relay" tooltipText="The relay to use with your gateway." className="mt-4" />
- <FilterableSelect
- value={relay}
- onChange={(newValue) => {
- if ((newValue as SingleValue<{ id: string }>)?.id === "_create") {
- navigate({
- search: (prev) => ({ ...prev, selectedTab: "relays", action: "deploy-relay" })
- });
- return;
- }
- setRelay(newValue as SingleValue<{ id: string; name: string }>);
- }}
- isLoading={isRelaysLoading}
- options={[
- { id: "_auto", name: "Auto Select Relay" },
- { id: "_create", name: "Deploy New Relay" },
- ...(relays || [])
- ]}
- placeholder="Select relay..."
- getOptionLabel={(option) => option.name}
- getOptionValue={(option) => option.id}
- components={{ Option: RelayOption }}
+ <form onSubmit={handleSubmit(onSubmit)}>
+ <Controller
+ control={control}
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ label="Name"
+ tooltipText="The name for your gateway."
+ isError={Boolean(error)}
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="Enter gateway name..." />
+ </FormControl>
+ )}
/>
- {errors.relay && <p className="mt-1 text-sm text-red">{errors.relay}</p>}
<div className="mt-6 flex items-center">
<Button
className="mr-4"
size="sm"
colorSchema="secondary"
- onClick={handleContinue}
- isLoading={isCreatingGateway || isConfiguringToken}
+ type="submit"
+ isLoading={isPending || isSubmitting}
>
- Continue
+ Create
</Button>
<ModalClose asChild>
<Button colorSchema="secondary" variant="plain">
@@ -247,15 +91,15 @@ const Content = () => {
</Button>
</ModalClose>
</div>
- </>
+ </form>
);
};
export const GatewayDeployModal = ({ isOpen, onOpenChange }: Props) => {
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
- <ModalContent className="max-w-2xl" title="Create Gateway" bodyClassName="overflow-visible">
- <Content />
+ <ModalContent className="max-w-md" title="Create Gateway" bodyClassName="overflow-visible">
+ <Content onClose={() => onOpenChange(false)} />
</ModalContent>
</Modal>
);
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/ReEnrollGatewayModal.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/ReEnrollGatewayModal.tsx
deleted file mode 100644
index 9cda8b450f..0000000000
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/ReEnrollGatewayModal.tsx
+++ /dev/null
@@ -1,164 +0,0 @@
-import { useEffect, useMemo, useState } from "react";
-import { faCopy, faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- FormLabel,
- IconButton,
- Input,
- Modal,
- ModalClose,
- ModalContent,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from "@app/components/v2";
-import { useConfigureGatewayTokenAuth } from "@app/hooks/api/gateways-v2";
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- gatewayData: { id: string; name: string; isPending: boolean } | null;
-};
-
-export const ReEnrollGatewayModal = ({ isOpen, onOpenChange, gatewayData }: Props) => {
- const { protocol, hostname, port } = window.location;
- const portSuffix = port && port !== "80" ? `:${port}` : "";
- const siteURL = `${protocol}//${hostname}${portSuffix}`;
-
- const [enrollmentToken, setEnrollmentToken] = useState("");
- const [isLoading, setIsLoading] = useState(false);
-
- const { mutateAsync: configureTokenAuth } = useConfigureGatewayTokenAuth();
-
- useEffect(() => {
- if (!isOpen || !gatewayData) return;
-
- setIsLoading(true);
- configureTokenAuth({ gatewayId: gatewayData.id })
- .then((result) => {
- setEnrollmentToken(result.token);
- })
- .catch(() => {
- createNotification({ type: "error", text: "Failed to generate enrollment token" });
- onOpenChange(false);
- })
- .finally(() => {
- setIsLoading(false);
- });
- }, [isOpen, gatewayData?.id]);
-
- const gatewayName = gatewayData?.name ?? "";
-
- const cliCommand = useMemo(() => {
- return `infisical gateway start ${gatewayName} --enroll-method=token --token=${enrollmentToken} --domain=${siteURL}`;
- }, [gatewayName, enrollmentToken, siteURL]);
-
- const systemdInstallCommand = useMemo(() => {
- return `sudo infisical gateway systemd install ${gatewayName} --enroll-method=token --token=${enrollmentToken} --domain=${siteURL}`;
- }, [gatewayName, enrollmentToken, siteURL]);
-
- const startServiceCommand = "sudo systemctl start infisical-gateway";
-
- const copyToClipboard = (text: string, label: string) => {
- navigator.clipboard.writeText(text);
- createNotification({ text: `${label} copied to clipboard`, type: "info" });
- };
-
- const handleClose = (open: boolean) => {
- if (!open) {
- setEnrollmentToken("");
- }
- onOpenChange(open);
- };
-
- if (!gatewayData) return null;
-
- return (
- <Modal isOpen={isOpen} onOpenChange={handleClose}>
- <ModalContent
- className="max-w-2xl"
- title={`Re-enroll ${gatewayData.name}`}
- subTitle="The existing gateway will keep running until the new machine enrolls."
- >
- {isLoading ? (
- <p className="text-sm text-mineshaft-300">Generating enrollment token...</p>
- ) : (
- <>
- <p className="mb-3 text-sm text-mineshaft-300">
- Run the following command on the machine where you want to deploy the gateway. The
- token expires in 1 hour and can only be used once.
- </p>
- <Tabs defaultValue="cli" className="mt-2">
- <TabList>
- <Tab value="cli">CLI</Tab>
- <Tab value="systemd">CLI (systemd)</Tab>
- </TabList>
- <TabPanel value="cli">
- <div className="flex gap-2">
- <Input value={cliCommand} isDisabled />
- <IconButton
- ariaLabel="copy"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(cliCommand, "Command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- </TabPanel>
- <TabPanel value="systemd">
- <FormLabel label="Installation Command" />
- <div className="flex gap-2">
- <Input value={systemdInstallCommand} isDisabled />
- <IconButton
- ariaLabel="copy install command"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(systemdInstallCommand, "Installation command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- <FormLabel label="Start the Gateway Service" className="mt-4" />
- <div className="flex gap-2">
- <Input value={startServiceCommand} isDisabled />
- <IconButton
- ariaLabel="copy start command"
- variant="outline_bg"
- colorSchema="secondary"
- onClick={() => copyToClipboard(startServiceCommand, "Start command")}
- className="w-10"
- >
- <FontAwesomeIcon icon={faCopy} />
- </IconButton>
- </div>
- </TabPanel>
- </Tabs>
- <a
- href="https://infisical.com/docs/cli/overview"
- target="_blank"
- className="mt-2 flex h-4 w-fit items-center gap-2 border-b border-mineshaft-400 text-sm text-mineshaft-400 transition-colors duration-100 hover:border-yellow-400 hover:text-yellow-400"
- rel="noreferrer"
- >
- <span>Install the Infisical CLI</span>
- <FontAwesomeIcon icon={faUpRightFromSquare} className="size-3" />
- </a>
- <div className="mt-6 flex items-center">
- <ModalClose asChild>
- <Button className="mr-4" size="sm" colorSchema="secondary">
- Done
- </Button>
- </ModalClose>
- </div>
- </>
- )}
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/organization/NetworkingPage/route.tsx b/frontend/src/pages/organization/NetworkingPage/route.tsx
index 09b089ba79..68f5897f5c 100644
--- a/frontend/src/pages/organization/NetworkingPage/route.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/route.tsx
@@ -10,7 +10,7 @@ const NetworkingPageQueryParams = z.object({
});
export const Route = createFileRoute(
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/"
)({
component: NetworkingPage,
validateSearch: zodValidator(NetworkingPageQueryParams),
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
index 187e48f770..24eac1727f 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
+++ b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
@@ -100,7 +100,8 @@ const orgGatewayPermissionSchema = z
[OrgGatewayPermissionActions.EditGateways]: z.boolean().optional(),
[OrgGatewayPermissionActions.DeleteGateways]: z.boolean().optional(),
[OrgGatewayPermissionActions.CreateGateways]: z.boolean().optional(),
- [OrgGatewayPermissionActions.AttachGateways]: z.boolean().optional()
+ [OrgGatewayPermissionActions.AttachGateways]: z.boolean().optional(),
+ [OrgGatewayPermissionActions.RevokeGatewayAccess]: z.boolean().optional()
})
.optional();
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
index 468b2f5f25..4f7615d59c 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionGatewayRow.tsx
@@ -28,7 +28,8 @@ const PERMISSION_ACTIONS = [
{ action: OrgGatewayPermissionActions.CreateGateways, label: "Create Gateways" },
{ action: OrgGatewayPermissionActions.EditGateways, label: "Edit Gateways" },
{ action: OrgGatewayPermissionActions.DeleteGateways, label: "Delete Gateways" },
- { action: OrgGatewayPermissionActions.AttachGateways, label: "Attach Gateways" }
+ { action: OrgGatewayPermissionActions.AttachGateways, label: "Attach Gateways" },
+ { action: OrgGatewayPermissionActions.RevokeGatewayAccess, label: "Revoke Gateway Access" }
] as const;
export const OrgGatewayPermissionRow = ({ isEditable, control, setValue }: Props) => {
@@ -80,9 +81,11 @@ export const OrgGatewayPermissionRow = ({ isEditable, control, setValue }: Props
"permissions.gateway",
{
[OrgGatewayPermissionActions.ListGateways]: true,
- [OrgGatewayPermissionActions.EditGateways]: true,
[OrgGatewayPermissionActions.CreateGateways]: true,
- [OrgGatewayPermissionActions.DeleteGateways]: true
+ [OrgGatewayPermissionActions.EditGateways]: true,
+ [OrgGatewayPermissionActions.DeleteGateways]: true,
+ [OrgGatewayPermissionActions.AttachGateways]: true,
+ [OrgGatewayPermissionActions.RevokeGatewayAccess]: true
},
{ shouldDirty: true }
);
@@ -92,9 +95,11 @@ export const OrgGatewayPermissionRow = ({ isEditable, control, setValue }: Props
"permissions.gateway",
{
[OrgGatewayPermissionActions.ListGateways]: true,
- [OrgGatewayPermissionActions.EditGateways]: false,
[OrgGatewayPermissionActions.CreateGateways]: false,
- [OrgGatewayPermissionActions.DeleteGateways]: false
+ [OrgGatewayPermissionActions.EditGateways]: false,
+ [OrgGatewayPermissionActions.DeleteGateways]: false,
+ [OrgGatewayPermissionActions.AttachGateways]: false,
+ [OrgGatewayPermissionActions.RevokeGatewayAccess]: false
},
{ shouldDirty: true }
);
@@ -106,9 +111,11 @@ export const OrgGatewayPermissionRow = ({ isEditable, control, setValue }: Props
"permissions.gateway",
{
[OrgGatewayPermissionActions.ListGateways]: false,
- [OrgGatewayPermissionActions.EditGateways]: false,
[OrgGatewayPermissionActions.CreateGateways]: false,
- [OrgGatewayPermissionActions.DeleteGateways]: false
+ [OrgGatewayPermissionActions.EditGateways]: false,
+ [OrgGatewayPermissionActions.DeleteGateways]: false,
+ [OrgGatewayPermissionActions.AttachGateways]: false,
+ [OrgGatewayPermissionActions.RevokeGatewayAccess]: false
},
{ shouldDirty: true }
);
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 9acecdf506..47addfddb1 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -51,7 +51,6 @@ import { Route as adminAccessManagementPageRouteImport } from './pages/admin/Acc
import { Route as adminGeneralPageRouteImport } from './pages/admin/GeneralPage/route'
import { Route as adminResourceOverviewPageRouteImport } from './pages/admin/ResourceOverviewPage/route'
import { Route as organizationProjectsPageRouteImport } from './pages/organization/ProjectsPage/route'
-import { Route as organizationNetworkingPageRouteImport } from './pages/organization/NetworkingPage/route'
import { Route as organizationBillingPageRouteImport } from './pages/organization/BillingPage/route'
import { Route as organizationAuditLogsPageRouteImport } from './pages/organization/AuditLogsPage/route'
import { Route as organizationAccessManagementPageRouteImport } from './pages/organization/AccessManagementPage/route'
@@ -71,9 +70,11 @@ import { Route as organizationIdentityDetailsByIDPageRouteImport } from './pages
import { Route as organizationGroupDetailsByIDPageRouteImport } from './pages/organization/GroupDetailsByIDPage/route'
import { Route as organizationSettingsPageRouteImport } from './pages/organization/SettingsPage/route'
import { Route as organizationSecretSharingPageRouteImport } from './pages/organization/SecretSharingPage/route'
+import { Route as organizationNetworkingPageRouteImport } from './pages/organization/NetworkingPage/route'
import { Route as organizationAppConnectionsAppConnectionsPageRouteImport } from './pages/organization/AppConnections/AppConnectionsPage/route'
import { Route as secretManagerRedirectsRedirectApprovalPageImport } from './pages/secret-manager/redirects/redirect-approval-page'
import { Route as organizationSettingsPageOauthCallbackPageRouteImport } from './pages/organization/SettingsPage/OauthCallbackPage/route'
+import { Route as organizationNetworkingPageGatewayDetailsByIDPageRouteImport } from './pages/organization/NetworkingPage/GatewayDetailsByIDPage/route'
import { Route as sshLayoutImport } from './pages/ssh/layout'
import { Route as secretScanningLayoutImport } from './pages/secret-scanning/layout'
import { Route as secretManagerLayoutImport } from './pages/secret-manager/layout'
@@ -298,6 +299,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingImport
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing',
)()
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport =
+ createFileRoute(
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking',
+ )()
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections',
@@ -703,6 +708,16 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRoute
} as any,
)
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport.update(
+ {
+ id: '/networking',
+ path: '/networking',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdRoute,
+ } as any,
+ )
+
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsImport.update(
{
@@ -728,14 +743,6 @@ const organizationProjectsPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdRoute,
} as any)
-const organizationNetworkingPageRouteRoute =
- organizationNetworkingPageRouteImport.update({
- id: '/networking',
- path: '/networking',
- getParentRoute: () =>
- AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdRoute,
- } as any)
-
const organizationBillingPageRouteRoute =
organizationBillingPageRouteImport.update({
id: '/billing',
@@ -899,6 +906,14 @@ const organizationSecretSharingPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRoute,
} as any)
+const organizationNetworkingPageRouteRoute =
+ organizationNetworkingPageRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute,
+ } as any)
+
const organizationAppConnectionsAppConnectionsPageRouteRoute =
organizationAppConnectionsAppConnectionsPageRouteImport.update({
id: '/',
@@ -986,6 +1001,14 @@ const organizationSettingsPageOauthCallbackPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRoute,
} as any)
+const organizationNetworkingPageGatewayDetailsByIDPageRouteRoute =
+ organizationNetworkingPageGatewayDetailsByIDPageRouteImport.update({
+ id: '/gateways/$gatewayId',
+ path: '/gateways/$gatewayId',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute,
+ } as any)
+
const sshLayoutRoute = sshLayoutImport.update({
id: '/_ssh-layout',
getParentRoute: () =>
@@ -2932,13 +2955,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationBillingPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdImport
}
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking': {
- id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking'
- path: '/networking'
- fullPath: '/organizations/$orgId/networking'
- preLoaderRoute: typeof organizationNetworkingPageRouteImport
- parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdImport
- }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects'
path: '/projects'
@@ -2960,6 +2976,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking'
+ path: '/networking'
+ fullPath: '/organizations/$orgId/networking'
+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing'
path: '/secret-sharing'
@@ -2981,6 +3004,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof organizationAppConnectionsAppConnectionsPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/'
+ path: '/'
+ fullPath: '/organizations/$orgId/networking/'
+ preLoaderRoute: typeof organizationNetworkingPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing/'
path: '/'
@@ -3100,6 +3130,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof redirectsOauthCallbackRedirectImport
parentRoute: typeof middlewaresInjectOrgDetailsImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId'
+ path: '/gateways/$gatewayId'
+ fullPath: '/organizations/$orgId/networking/gateways/$gatewayId'
+ preLoaderRoute: typeof organizationNetworkingPageGatewayDetailsByIDPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback'
path: '/oauth/callback'
@@ -5709,6 +5746,23 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRoute
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRouteChildren,
)
+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteChildren {
+ organizationNetworkingPageRouteRoute: typeof organizationNetworkingPageRouteRoute
+ organizationNetworkingPageGatewayDetailsByIDPageRouteRoute: typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute
+}
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteChildren =
+ {
+ organizationNetworkingPageRouteRoute: organizationNetworkingPageRouteRoute,
+ organizationNetworkingPageGatewayDetailsByIDPageRouteRoute:
+ organizationNetworkingPageGatewayDetailsByIDPageRouteRoute,
+ }
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteWithChildren =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute._addFileChildren(
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteChildren,
+ )
+
interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteChildren {
organizationSecretSharingPageRouteRoute: typeof organizationSecretSharingPageRouteRoute
}
@@ -5760,9 +5814,9 @@ interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdRouteChildren {
organizationAccessManagementPageRouteRoute: typeof organizationAccessManagementPageRouteRoute
organizationAuditLogsPageRouteRoute: typeof organizationAuditLogsPageRouteRoute
organizationBillingPageRouteRoute: typeof organizationBillingPageRouteRoute
- organizationNetworkingPageRouteRoute: typeof organizationNetworkingPageRouteRoute
organizationProjectsPageRouteRoute: typeof organizationProjectsPageRouteRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRouteWithChildren
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteWithChildren
organizationGroupDetailsByIDPageRouteRoute: typeof organizationGroupDetailsByIDPageRouteRoute
@@ -5778,11 +5832,12 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdRouteChildren: Auth
organizationAccessManagementPageRouteRoute,
organizationAuditLogsPageRouteRoute: organizationAuditLogsPageRouteRoute,
organizationBillingPageRouteRoute: organizationBillingPageRouteRoute,
- organizationNetworkingPageRouteRoute: organizationNetworkingPageRouteRoute,
organizationProjectsPageRouteRoute:
organizationProjectsPageRouteRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRouteWithChildren,
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRoute:
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRoute:
@@ -6041,13 +6096,14 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/access-management': typeof organizationAccessManagementPageRouteRoute
'/organizations/$orgId/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/organizations/$orgId/billing': typeof organizationBillingPageRouteRoute
- '/organizations/$orgId/networking': typeof organizationNetworkingPageRouteRoute
'/organizations/$orgId/projects': typeof organizationProjectsPageRouteRouteWithChildren
'/admin/resources/overview': typeof adminResourceOverviewPageRouteRoute
'/organizations/$orgId/app-connections': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRouteWithChildren
+ '/organizations/$orgId/networking': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteWithChildren
'/organizations/$orgId/secret-sharing': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteWithChildren
'/organizations/$orgId/settings': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteWithChildren
'/organizations/$orgId/app-connections/': typeof organizationAppConnectionsAppConnectionsPageRouteRoute
+ '/organizations/$orgId/networking/': typeof organizationNetworkingPageRouteRoute
'/organizations/$orgId/secret-sharing/': typeof organizationSecretSharingPageRouteRoute
'/organizations/$orgId/settings/': typeof organizationSettingsPageRouteRoute
'/organizations/$orgId/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
@@ -6065,6 +6121,7 @@ export interface FileRoutesByFullPath {
'/integrations/vercel/oauth2/callback': typeof secretManagerIntegrationsRouteVercelOauthRedirectRoute
'/organizations/$orgId/secret-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretManagerProjectIdRouteWithChildren
'/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute
+ '/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute
'/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute
'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren
'/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren
@@ -6319,10 +6376,10 @@ export interface FileRoutesByTo {
'/organizations/$orgId/access-management': typeof organizationAccessManagementPageRouteRoute
'/organizations/$orgId/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/organizations/$orgId/billing': typeof organizationBillingPageRouteRoute
- '/organizations/$orgId/networking': typeof organizationNetworkingPageRouteRoute
'/organizations/$orgId/projects': typeof organizationProjectsPageRouteRouteWithChildren
'/admin/resources/overview': typeof adminResourceOverviewPageRouteRoute
'/organizations/$orgId/app-connections': typeof organizationAppConnectionsAppConnectionsPageRouteRoute
+ '/organizations/$orgId/networking': typeof organizationNetworkingPageRouteRoute
'/organizations/$orgId/secret-sharing': typeof organizationSecretSharingPageRouteRoute
'/organizations/$orgId/settings': typeof organizationSettingsPageRouteRoute
'/organizations/$orgId/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
@@ -6340,6 +6397,7 @@ export interface FileRoutesByTo {
'/integrations/vercel/oauth2/callback': typeof secretManagerIntegrationsRouteVercelOauthRedirectRoute
'/organizations/$orgId/secret-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretManagerProjectIdRouteWithChildren
'/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute
+ '/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute
'/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute
'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren
'/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerDashboardPageRouteIndexRoute
@@ -6584,13 +6642,14 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/access-management': typeof organizationAccessManagementPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/audit-logs': typeof organizationAuditLogsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/billing': typeof organizationBillingPageRouteRoute
- '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking': typeof organizationNetworkingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects': typeof organizationProjectsPageRouteRouteWithChildren
'/_authenticate/_inject-org-details/admin/_admin-layout/resources/overview': typeof adminResourceOverviewPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdAppConnectionsRouteWithChildren
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdNetworkingRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretSharingRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSettingsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/': typeof organizationAppConnectionsAppConnectionsPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/': typeof organizationNetworkingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing/': typeof organizationSecretSharingPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/': typeof organizationSettingsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/groups/$groupId': typeof organizationGroupDetailsByIDPageRouteRoute
@@ -6608,6 +6667,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/integrations/vercel/oauth2/callback': typeof secretManagerIntegrationsRouteVercelOauthRedirectRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretManagerProjectIdRouteWithChildren
'/_authenticate/_inject-org-details/organization/app-connections/$appConnection/oauth/callback': typeof redirectsOauthCallbackRedirectRoute
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId': typeof organizationNetworkingPageGatewayDetailsByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsAiProjectIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsCertManagerProjectIdRouteWithChildren
@@ -6875,13 +6935,14 @@ export interface FileRouteTypes {
| '/organizations/$orgId/access-management'
| '/organizations/$orgId/audit-logs'
| '/organizations/$orgId/billing'
- | '/organizations/$orgId/networking'
| '/organizations/$orgId/projects'
| '/admin/resources/overview'
| '/organizations/$orgId/app-connections'
+ | '/organizations/$orgId/networking'
| '/organizations/$orgId/secret-sharing'
| '/organizations/$orgId/settings'
| '/organizations/$orgId/app-connections/'
+ | '/organizations/$orgId/networking/'
| '/organizations/$orgId/secret-sharing/'
| '/organizations/$orgId/settings/'
| '/organizations/$orgId/groups/$groupId'
@@ -6899,6 +6960,7 @@ export interface FileRouteTypes {
| '/integrations/vercel/oauth2/callback'
| '/organizations/$orgId/secret-manager/$projectId'
| '/organization/app-connections/$appConnection/oauth/callback'
+ | '/organizations/$orgId/networking/gateways/$gatewayId'
| '/organizations/$orgId/settings/oauth/callback'
| '/organizations/$orgId/projects/ai/$projectId'
| '/organizations/$orgId/projects/cert-manager/$projectId'
@@ -7152,10 +7214,10 @@ export interface FileRouteTypes {
| '/organizations/$orgId/access-management'
| '/organizations/$orgId/audit-logs'
| '/organizations/$orgId/billing'
- | '/organizations/$orgId/networking'
| '/organizations/$orgId/projects'
| '/admin/resources/overview'
| '/organizations/$orgId/app-connections'
+ | '/organizations/$orgId/networking'
| '/organizations/$orgId/secret-sharing'
| '/organizations/$orgId/settings'
| '/organizations/$orgId/groups/$groupId'
@@ -7173,6 +7235,7 @@ export interface FileRouteTypes {
| '/integrations/vercel/oauth2/callback'
| '/organizations/$orgId/secret-manager/$projectId'
| '/organization/app-connections/$appConnection/oauth/callback'
+ | '/organizations/$orgId/networking/gateways/$gatewayId'
| '/organizations/$orgId/settings/oauth/callback'
| '/organizations/$orgId/projects/ai/$projectId'
| '/organizations/$orgId/projects/cert-manager/$projectId'
@@ -7415,13 +7478,14 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/access-management'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/audit-logs'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/billing'
- | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects'
| '/_authenticate/_inject-org-details/admin/_admin-layout/resources/overview'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/groups/$groupId'
@@ -7439,6 +7503,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/integrations/vercel/oauth2/callback'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-manager/$projectId'
| '/_authenticate/_inject-org-details/organization/app-connections/$appConnection/oauth/callback'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId'
@@ -7939,9 +8004,9 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/access-management",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/audit-logs",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/billing",
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/groups/$groupId",
@@ -7963,10 +8028,6 @@ export const routeTree = rootRoute
"filePath": "organization/BillingPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId"
},
- "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking": {
- "filePath": "organization/NetworkingPage/route.tsx",
- "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId"
- },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects": {
"filePath": "organization/ProjectsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId",
@@ -7992,6 +8053,14 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections/$appConnection/oauth/callback"
]
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking": {
+ "filePath": "",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId",
+ "children": [
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId"
+ ]
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId",
@@ -8011,6 +8080,10 @@ export const routeTree = rootRoute
"filePath": "organization/AppConnections/AppConnectionsPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/app-connections"
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/": {
+ "filePath": "organization/NetworkingPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing/": {
"filePath": "organization/SecretSharingPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/secret-sharing"
@@ -8082,6 +8155,10 @@ export const routeTree = rootRoute
"filePath": "redirects/oauth-callback-redirect.tsx",
"parent": "/_authenticate/_inject-org-details"
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking/gateways/$gatewayId": {
+ "filePath": "organization/NetworkingPage/GatewayDetailsByIDPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/networking"
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings/oauth/callback": {
"filePath": "organization/SettingsPage/OauthCallbackPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/settings"
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index 126361ec59..6408c9d9ed 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -447,7 +447,10 @@ const organizationRoutes = route("/organizations/$orgId", [
"organization/AppConnections/OauthCallbackPage/route.tsx"
)
]),
- route("/networking", "organization/NetworkingPage/route.tsx")
+ route("/networking", [
+ index("organization/NetworkingPage/route.tsx"),
+ route("/gateways/$gatewayId", "organization/NetworkingPage/GatewayDetailsByIDPage/route.tsx")
+ ])
]);
export const routes = rootRoute("root.tsx", [