Skip to content

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

feat(pam): move ad server resources to dedicated domains section

x032205500b676fe291
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.ts
index 2a7dc22076..02fa5e3e36 100644
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@ -30,6 +30,7 @@ import { TLicenseServiceFactory } from "@app/ee/services/license/license-service
import { TOidcConfigServiceFactory } from "@app/ee/services/oidc/oidc-config-service";
import { TPamAccountServiceFactory } from "@app/ee/services/pam-account/pam-account-service";
import { TPamDiscoverySourceServiceFactory } from "@app/ee/services/pam-discovery/pam-discovery-source-service";
+import { TPamDomainServiceFactory } from "@app/ee/services/pam-domain/pam-domain-service";
import { TPamFolderServiceFactory } from "@app/ee/services/pam-folder/pam-folder-service";
import { TPamResourceRotationRulesServiceFactory } from "@app/ee/services/pam-resource/pam-resource-rotation-rules-service";
import { TPamResourceServiceFactory } from "@app/ee/services/pam-resource/pam-resource-service";
@@ -380,6 +381,7 @@ declare module "fastify" {
offlineUsageReport: TOfflineUsageReportServiceFactory;
pamFolder: TPamFolderServiceFactory;
pamResource: TPamResourceServiceFactory;
+ pamDomain: TPamDomainServiceFactory;
pamResourceRotationRules: TPamResourceRotationRulesServiceFactory;
pamAccount: TPamAccountServiceFactory;
pamSession: TPamSessionServiceFactory;
diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.ts
index 354b77ea1a..ed37511e95 100644
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@ -700,6 +700,7 @@ import {
TPamDiscoverySourcesInsert,
TPamDiscoverySourcesUpdate
} from "@app/db/schemas/pam-discovery-sources";
+import { TPamDomains, TPamDomainsInsert, TPamDomainsUpdate } from "@app/db/schemas/pam-domains";
import { TPamFolders, TPamFoldersInsert, TPamFoldersUpdate } from "@app/db/schemas/pam-folders";
import {
TPamResourceFavorites,
@@ -1590,6 +1591,7 @@ declare module "knex/types/tables" {
TPamResourceFavoritesInsert,
TPamResourceFavoritesUpdate
>;
+ [TableName.PamDomain]: KnexOriginal.CompositeTableType<TPamDomains, TPamDomainsInsert, TPamDomainsUpdate>;
[TableName.PamAccount]: KnexOriginal.CompositeTableType<TPamAccounts, TPamAccountsInsert, TPamAccountsUpdate>;
[TableName.PamSession]: KnexOriginal.CompositeTableType<TPamSessions, TPamSessionsInsert, TPamSessionsUpdate>;
[TableName.PamDiscoverySource]: KnexOriginal.CompositeTableType<
diff --git a/backend/src/db/migrations/20260408062748_pam-domains.ts b/backend/src/db/migrations/20260408062748_pam-domains.ts
new file mode 100644
index 0000000000..de4e86d623
--- /dev/null
+++ b/backend/src/db/migrations/20260408062748_pam-domains.ts
@@ -0,0 +1,222 @@
+/* eslint-disable no-await-in-loop, @typescript-eslint/no-explicit-any */
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";
+
+export async function up(knex: Knex): Promise<void> {
+ // \Create pam_domains table
+ if (!(await knex.schema.hasTable(TableName.PamDomain))) {
+ await knex.schema.createTable(TableName.PamDomain, (t) => {
+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());
+
+ t.string("projectId").notNullable();
+ t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");
+ t.index("projectId");
+
+ t.string("name").notNullable();
+ t.index("name");
+
+ t.string("domainType").notNullable();
+ t.index("domainType");
+
+ t.uuid("gatewayId").nullable();
+ t.foreign("gatewayId").references("id").inTable(TableName.GatewayV2);
+ t.index("gatewayId");
+
+ t.binary("encryptedConnectionDetails").notNullable();
+ t.string("discoveryFingerprint").nullable();
+
+ t.unique(["projectId", "name"]);
+
+ t.timestamps(true, true, true);
+ });
+
+ await createOnUpdateTrigger(knex, TableName.PamDomain);
+ }
+
+ // Add domainId to pam_resources
+ if (await knex.schema.hasTable(TableName.PamResource)) {
+ const hasDomainId = await knex.schema.hasColumn(TableName.PamResource, "domainId");
+ if (!hasDomainId) {
+ await knex.schema.alterTable(TableName.PamResource, (t) => {
+ t.uuid("domainId").nullable();
+ t.foreign("domainId").references("id").inTable(TableName.PamDomain).onDelete("SET NULL");
+ t.index("domainId");
+ });
+ }
+ }
+
+ // Add domainId to pam_accounts (exactly one of resourceId/domainId must be set)
+ if (await knex.schema.hasTable(TableName.PamAccount)) {
+ const hasDomainId = await knex.schema.hasColumn(TableName.PamAccount, "domainId");
+ if (!hasDomainId) {
+ await knex.schema.alterTable(TableName.PamAccount, (t) => {
+ t.uuid("domainId").nullable();
+ t.foreign("domainId").references("id").inTable(TableName.PamDomain).onDelete("CASCADE");
+ t.index("domainId");
+ });
+
+ await knex.schema.alterTable(TableName.PamAccount, (t) => {
+ t.uuid("resourceId").nullable().alter();
+ });
+
+ await knex.raw(`
+ ALTER TABLE ${TableName.PamAccount}
+ ADD CONSTRAINT chk_pam_account_parent
+ CHECK (
+ (("resourceId" IS NOT NULL AND "domainId" IS NULL) OR ("resourceId" IS NULL AND "domainId" IS NOT NULL))
+ )
+ `);
+ }
+ }
+
+ // Add pamDomainId to resource_metadata
+ if (await knex.schema.hasTable(TableName.ResourceMetadata)) {
+ const hasPamDomainId = await knex.schema.hasColumn(TableName.ResourceMetadata, "pamDomainId");
+ if (!hasPamDomainId) {
+ await knex.schema.alterTable(TableName.ResourceMetadata, (t) => {
+ t.uuid("pamDomainId").nullable();
+ t.foreign("pamDomainId").references("id").inTable(TableName.PamDomain).onDelete("CASCADE");
+ });
+ }
+ }
+
+ // Migrate existing AD resources to domains (preserving IDs for referential integrity)
+ const adResources = await knex(TableName.PamResource).where("resourceType", "active-directory").select("*");
+
+ for (const adResource of adResources) {
+ await knex(TableName.PamDomain).insert({
+ id: adResource.id,
+ projectId: adResource.projectId,
+ name: adResource.name,
+ domainType: "active-directory",
+ gatewayId: adResource.gatewayId,
+ encryptedConnectionDetails: adResource.encryptedConnectionDetails,
+ discoveryFingerprint: adResource.discoveryFingerprint
+ } as any);
+
+ await knex(TableName.PamAccount)
+ .where("resourceId", adResource.id)
+ .update({
+ domainId: adResource.id,
+ resourceId: null
+ } as any);
+
+ await knex(TableName.PamResource)
+ .where("adServerResourceId", adResource.id)
+ .update({
+ domainId: adResource.id,
+ adServerResourceId: null
+ } as any);
+
+ await knex(TableName.PamResourceRotationRule).where("resourceId", adResource.id).delete();
+ await knex(TableName.PamDiscoverySourceResource).where("resourceId", adResource.id).delete();
+
+ await knex(TableName.ResourceMetadata)
+ .where("pamResourceId", adResource.id)
+ .update({
+ pamDomainId: adResource.id,
+ pamResourceId: null
+ } as any);
+
+ await knex(TableName.PamResource).where("id", adResource.id).delete();
+ }
+
+ // Drop adServerResourceId column from pam_resources
+ if (await knex.schema.hasTable(TableName.PamResource)) {
+ const hasAdServerResourceId = await knex.schema.hasColumn(TableName.PamResource, "adServerResourceId");
+ if (hasAdServerResourceId) {
+ await knex.schema.alterTable(TableName.PamResource, (t) => {
+ t.dropColumn("adServerResourceId");
+ });
+ }
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ if (await knex.schema.hasTable(TableName.PamResource)) {
+ const hasAdServerResourceId = await knex.schema.hasColumn(TableName.PamResource, "adServerResourceId");
+ if (!hasAdServerResourceId) {
+ await knex.schema.alterTable(TableName.PamResource, (t) => {
+ t.uuid("adServerResourceId").nullable();
+ t.foreign("adServerResourceId").references("id").inTable(TableName.PamResource).onDelete("SET NULL");
+ });
+ }
+ }
+
+ if (await knex.schema.hasTable(TableName.PamDomain)) {
+ const domains = await knex(TableName.PamDomain).where("domainType", "active-directory").select("*");
+
+ for (const domain of domains) {
+ await knex(TableName.PamResource).insert({
+ id: domain.id,
+ projectId: domain.projectId,
+ name: domain.name,
+ resourceType: "active-directory",
+ gatewayId: domain.gatewayId,
+ encryptedConnectionDetails: domain.encryptedConnectionDetails,
+ discoveryFingerprint: domain.discoveryFingerprint
+ } as any);
+
+ await knex(TableName.PamAccount)
+ .where("domainId", domain.id)
+ .update({
+ resourceId: domain.id,
+ domainId: null
+ } as any);
+
+ await knex(TableName.PamResource)
+ .where("domainId", domain.id)
+ .update({
+ adServerResourceId: domain.id,
+ domainId: null
+ } as any);
+
+ await knex(TableName.ResourceMetadata)
+ .where("pamDomainId", domain.id)
+ .update({
+ pamResourceId: domain.id,
+ pamDomainId: null
+ } as any);
+
+ await knex(TableName.PamDomain).where("id", domain.id).delete();
+ }
+ }
+
+ await knex.raw(`
+ ALTER TABLE ${TableName.PamAccount}
+ DROP CONSTRAINT IF EXISTS chk_pam_account_parent
+ `);
+
+ if (await knex.schema.hasTable(TableName.PamAccount)) {
+ const hasDomainId = await knex.schema.hasColumn(TableName.PamAccount, "domainId");
+ if (hasDomainId) {
+ await knex.schema.alterTable(TableName.PamAccount, (t) => {
+ t.uuid("resourceId").notNullable().alter();
+ t.dropColumn("domainId");
+ });
+ }
+ }
+
+ if (await knex.schema.hasTable(TableName.ResourceMetadata)) {
+ const hasPamDomainId = await knex.schema.hasColumn(TableName.ResourceMetadata, "pamDomainId");
+ if (hasPamDomainId) {
+ await knex.schema.alterTable(TableName.ResourceMetadata, (t) => {
+ t.dropColumn("pamDomainId");
+ });
+ }
+ }
+
+ if (await knex.schema.hasTable(TableName.PamResource)) {
+ const hasDomainId = await knex.schema.hasColumn(TableName.PamResource, "domainId");
+ if (hasDomainId) {
+ await knex.schema.alterTable(TableName.PamResource, (t) => {
+ t.dropColumn("domainId");
+ });
+ }
+ }
+
+ await dropOnUpdateTrigger(knex, TableName.PamDomain);
+ await knex.schema.dropTableIfExists(TableName.PamDomain);
+}
diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.ts
index 3dbfc57412..9f12c27bce 100644
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@ -116,6 +116,7 @@ export * from "./pam-discovery-source-dependencies";
export * from "./pam-discovery-source-resources";
export * from "./pam-discovery-source-runs";
export * from "./pam-discovery-sources";
+export * from "./pam-domains";
export * from "./pam-folders";
export * from "./pam-resource-favorites";
export * from "./pam-resource-rotation-rules";
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.ts
index 134cde6731..3f291a285c 100644
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@ -235,6 +235,7 @@ export enum TableName {
PamAccountDependency = "pam_account_dependencies",
PamResourceRotationRule = "pam_resource_rotation_rules",
PamResourceFavorite = "pam_resource_favorites",
+ PamDomain = "pam_domains",
VaultExternalMigrationConfig = "vault_external_migration_configs",
diff --git a/backend/src/db/schemas/pam-accounts.ts b/backend/src/db/schemas/pam-accounts.ts
index f45ede2950..4c2e8ce690 100644
--- a/backend/src/db/schemas/pam-accounts.ts
+++ b/backend/src/db/schemas/pam-accounts.ts
@@ -13,7 +13,7 @@ export const PamAccountsSchema = z.object({
id: z.string().uuid(),
projectId: z.string(),
folderId: z.string().uuid().nullable().optional(),
- resourceId: z.string().uuid(),
+ resourceId: z.string().uuid().nullable().optional(),
name: z.string(),
description: z.string().nullable().optional(),
encryptedCredentials: zodBuffer,
@@ -24,7 +24,8 @@ export const PamAccountsSchema = z.object({
encryptedLastRotationMessage: zodBuffer.nullable().optional(),
requireMfa: z.boolean().default(false).nullable().optional(),
internalMetadata: z.unknown().nullable().optional(),
- discoveryFingerprint: z.string().nullable().optional()
+ discoveryFingerprint: z.string().nullable().optional(),
+ domainId: z.string().uuid().nullable().optional()
});
export type TPamAccounts = z.infer<typeof PamAccountsSchema>;
diff --git a/backend/src/db/schemas/pam-discovery-source-resources.ts b/backend/src/db/schemas/pam-discovery-source-resources.ts
index 12f5c2a410..f17f7ce615 100644
--- a/backend/src/db/schemas/pam-discovery-source-resources.ts
+++ b/backend/src/db/schemas/pam-discovery-source-resources.ts
@@ -10,11 +10,12 @@ import { TImmutableDBKeys } from "./models";
export const PamDiscoverySourceResourcesSchema = z.object({
id: z.string().uuid(),
discoverySourceId: z.string().uuid(),
- resourceId: z.string().uuid(),
+ resourceId: z.string().uuid().nullable().optional(),
lastDiscoveredAt: z.date(),
lastDiscoveredRunId: z.string().uuid().nullable().optional(),
isStale: z.boolean().default(false).nullable().optional(),
- createdAt: z.date().nullable().optional()
+ createdAt: z.date().nullable().optional(),
+ domainId: z.string().uuid().nullable().optional()
});
export type TPamDiscoverySourceResources = z.infer<typeof PamDiscoverySourceResourcesSchema>;
diff --git a/backend/src/db/schemas/pam-domains.ts b/backend/src/db/schemas/pam-domains.ts
new file mode 100644
index 0000000000..99241c5bd4
--- /dev/null
+++ b/backend/src/db/schemas/pam-domains.ts
@@ -0,0 +1,27 @@
+// 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 { zodBuffer } from "@app/lib/zod";
+
+import { TImmutableDBKeys } from "./models";
+
+export const PamDomainsSchema = z.object({
+ id: z.string().uuid(),
+ projectId: z.string(),
+ name: z.string(),
+ domainType: z.string(),
+ gatewayId: z.string().uuid().nullable().optional(),
+ encryptedConnectionDetails: zodBuffer,
+ encryptedRotationAccountCredentials: zodBuffer.nullable().optional(),
+ discoveryFingerprint: z.string().nullable().optional(),
+ createdAt: z.date(),
+ updatedAt: z.date()
+});
+
+export type TPamDomains = z.infer<typeof PamDomainsSchema>;
+export type TPamDomainsInsert = Omit<z.input<typeof PamDomainsSchema>, TImmutableDBKeys>;
+export type TPamDomainsUpdate = Partial<Omit<z.input<typeof PamDomainsSchema>, TImmutableDBKeys>>;
diff --git a/backend/src/db/schemas/pam-resources.ts b/backend/src/db/schemas/pam-resources.ts
index b77d17eda0..7ca08df545 100644
--- a/backend/src/db/schemas/pam-resources.ts
+++ b/backend/src/db/schemas/pam-resources.ts
@@ -20,8 +20,8 @@ export const PamResourcesSchema = z.object({
updatedAt: z.date(),
encryptedRotationAccountCredentials: zodBuffer.nullable().optional(),
encryptedResourceMetadata: zodBuffer.nullable().optional(),
- adServerResourceId: z.string().uuid().nullable().optional(),
- discoveryFingerprint: z.string().nullable().optional()
+ discoveryFingerprint: z.string().nullable().optional(),
+ domainId: z.string().uuid().nullable().optional()
});
export type TPamResources = z.infer<typeof PamResourcesSchema>;
diff --git a/backend/src/db/schemas/resource-metadata.ts b/backend/src/db/schemas/resource-metadata.ts
index 4bb113d139..c2f0acf01d 100644
--- a/backend/src/db/schemas/resource-metadata.ts
+++ b/backend/src/db/schemas/resource-metadata.ts
@@ -25,7 +25,8 @@ export const ResourceMetadataSchema = z.object({
certificateRequestId: z.string().uuid().nullable().optional(),
certificateRequestCreatedAt: z.date().nullable().optional(),
pamResourceId: z.string().uuid().nullable().optional(),
- pamAccountId: z.string().uuid().nullable().optional()
+ pamAccountId: z.string().uuid().nullable().optional(),
+ pamDomainId: z.string().uuid().nullable().optional()
});
export type TResourceMetadata = z.infer<typeof ResourceMetadataSchema>;
diff --git a/backend/src/ee/routes/v1/index.ts b/backend/src/ee/routes/v1/index.ts
index e75e6871ac..3349f6e78f 100644
--- a/backend/src/ee/routes/v1/index.ts
+++ b/backend/src/ee/routes/v1/index.ts
@@ -31,6 +31,11 @@ import { PAM_ACCOUNT_REGISTER_ROUTER_MAP } from "./pam-account-routers";
import { registerPamAccountRouter } from "./pam-account-routers/pam-account-router";
import { PAM_DISCOVERY_REGISTER_ROUTER_MAP } from "./pam-discovery-routers";
import { registerPamDiscoveryRouter } from "./pam-discovery-routers/pam-discovery-router";
+import {
+ PAM_DOMAIN_ACCOUNT_REGISTER_ROUTER_MAP,
+ PAM_DOMAIN_REGISTER_ROUTER_MAP,
+ registerPamDomainRouter
+} from "./pam-domain-routers";
import { registerPamFolderRouter } from "./pam-folder-router";
import { PAM_RESOURCE_REGISTER_ROUTER_MAP } from "./pam-resource-routers";
import { registerPamResourceRotationRulesRouter } from "./pam-resource-routers/pam-resource-rotation-rules-router";
@@ -202,6 +207,19 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {
async (pamRouter) => {
await pamRouter.register(registerPamFolderRouter, { prefix: "/folders" });
await pamRouter.register(registerPamSessionRouter, { prefix: "/sessions" });
+ await pamRouter.register(
+ async (pamDomainRouter) => {
+ await pamDomainRouter.register(registerPamDomainRouter);
+
+ // Domain-type-specific endpoints
+ await Promise.all(
+ Object.entries(PAM_DOMAIN_REGISTER_ROUTER_MAP).map(([provider, router]) =>
+ pamDomainRouter.register(router, { prefix: `/${provider}` })
+ )
+ );
+ },
+ { prefix: "/domains" }
+ );
await pamRouter.register(
async (pamDiscoveryRouter) => {
await pamDiscoveryRouter.register(registerPamDiscoveryRouter);
@@ -220,12 +238,19 @@ export const registerV1EERoutes = async (server: FastifyZodProvider) => {
async (pamAccountRouter) => {
await pamAccountRouter.register(registerPamAccountRouter);
- // Provider-specific endpoints
+ // Resource-type-specific account endpoints
await Promise.all(
Object.entries(PAM_ACCOUNT_REGISTER_ROUTER_MAP).map(([provider, router]) =>
pamAccountRouter.register(router, { prefix: `/${provider}` })
)
);
+
+ // Domain-type-specific account endpoints
+ await Promise.all(
+ Object.entries(PAM_DOMAIN_ACCOUNT_REGISTER_ROUTER_MAP).map(([provider, router]) =>
+ pamAccountRouter.register(router, { prefix: `/${provider}` })
+ )
+ );
},
{ prefix: "/accounts" }
);
diff --git a/backend/src/ee/routes/v1/pam-account-routers/index.ts b/backend/src/ee/routes/v1/pam-account-routers/index.ts
index 3f9eb4e1f4..d421df50a0 100644
--- a/backend/src/ee/routes/v1/pam-account-routers/index.ts
+++ b/backend/src/ee/routes/v1/pam-account-routers/index.ts
@@ -1,8 +1,3 @@
-import {
- CreateActiveDirectoryAccountSchema,
- SanitizedActiveDirectoryAccountWithResourceSchema,
- UpdateActiveDirectoryAccountSchema
-} from "@app/ee/services/pam-resource/active-directory/active-directory-resource-schemas";
import {
CreateAwsIamAccountSchema,
SanitizedAwsIamAccountWithResourceSchema,
@@ -56,7 +51,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.Postgres]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.Postgres,
+ parentType: PamResource.Postgres,
accountResponseSchema: SanitizedPostgresAccountWithResourceSchema,
createAccountSchema: CreatePostgresAccountSchema,
updateAccountSchema: UpdatePostgresAccountSchema
@@ -65,7 +60,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.MySQL]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.MySQL,
+ parentType: PamResource.MySQL,
accountResponseSchema: SanitizedMySQLAccountWithResourceSchema,
createAccountSchema: CreateMySQLAccountSchema,
updateAccountSchema: UpdateMySQLAccountSchema
@@ -74,7 +69,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.MsSQL]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.MsSQL,
+ parentType: PamResource.MsSQL,
accountResponseSchema: SanitizedMsSQLAccountWithResourceSchema,
createAccountSchema: CreateMsSQLAccountSchema,
updateAccountSchema: UpdateMsSQLAccountSchema
@@ -83,7 +78,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.Redis]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.Redis,
+ parentType: PamResource.Redis,
accountResponseSchema: SanitizedRedisAccountWithResourceSchema,
createAccountSchema: CreateRedisAccountSchema,
updateAccountSchema: UpdateRedisAccountSchema
@@ -92,7 +87,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.MongoDB]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.MongoDB,
+ parentType: PamResource.MongoDB,
accountResponseSchema: SanitizedMongoDBAccountWithResourceSchema,
createAccountSchema: CreateMongoDBAccountSchema,
updateAccountSchema: UpdateMongoDBAccountSchema
@@ -101,7 +96,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.SSH]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.SSH,
+ parentType: PamResource.SSH,
accountResponseSchema: SanitizedSSHAccountWithResourceSchema,
createAccountSchema: CreateSSHAccountSchema,
updateAccountSchema: UpdateSSHAccountSchema
@@ -110,7 +105,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.Kubernetes]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.Kubernetes,
+ parentType: PamResource.Kubernetes,
accountResponseSchema: SanitizedKubernetesAccountWithResourceSchema,
createAccountSchema: CreateKubernetesAccountSchema,
updateAccountSchema: UpdateKubernetesAccountSchema
@@ -119,7 +114,7 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.AwsIam]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.AwsIam,
+ parentType: PamResource.AwsIam,
accountResponseSchema: SanitizedAwsIamAccountWithResourceSchema,
createAccountSchema: CreateAwsIamAccountSchema,
updateAccountSchema: UpdateAwsIamAccountSchema
@@ -128,19 +123,10 @@ export const PAM_ACCOUNT_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fasti
[PamResource.Windows]: async (server: FastifyZodProvider) => {
registerPamAccountEndpoints({
server,
- resourceType: PamResource.Windows,
+ parentType: PamResource.Windows,
accountResponseSchema: SanitizedWindowsAccountWithResourceSchema,
createAccountSchema: CreateWindowsAccountSchema,
updateAccountSchema: UpdateWindowsAccountSchema
});
- },
- [PamResource.ActiveDirectory]: async (server: FastifyZodProvider) => {
- registerPamAccountEndpoints({
- server,
- resourceType: PamResource.ActiveDirectory,
- accountResponseSchema: SanitizedActiveDirectoryAccountWithResourceSchema,
- createAccountSchema: CreateActiveDirectoryAccountSchema,
- updateAccountSchema: UpdateActiveDirectoryAccountSchema
- });
}
};
diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
index 92bc6576f8..6e3747cc03 100644
--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
@@ -1,7 +1,7 @@
import { z } from "zod";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
-import { PamResource } from "@app/ee/services/pam-resource/pam-resource-enums";
+import { PamParentType } from "@app/ee/services/pam-account/pam-account-enums";
import { TPamAccount } from "@app/ee/services/pam-resource/pam-resource-types";
import { writeLimit } from "@app/server/config/rateLimiter";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
@@ -12,16 +12,17 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
export const registerPamAccountEndpoints = <C extends TPamAccount>({
server,
- resourceType,
+ parentType,
createAccountSchema,
updateAccountSchema,
accountResponseSchema
}: {
server: FastifyZodProvider;
- resourceType: PamResource;
+ parentType: PamParentType;
createAccountSchema: z.ZodType<{
credentials: C["credentials"];
- resourceId: C["resourceId"];
+ resourceId?: C["resourceId"];
+ domainId?: C["domainId"];
folderId?: C["folderId"];
name: C["name"];
description?: C["description"];
@@ -39,9 +40,9 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
}>;
accountResponseSchema: z.ZodTypeAny;
}) => {
- // Convert resource type enum value to PascalCase for operation IDs
+ // Convert parent type enum value to PascalCase for operation IDs
// e.g., "postgres" -> "Postgres", "aws-iam" -> "AwsIam"
- const resourceTypeId = resourceType
+ const parentTypeId = parentType
.split("-")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join("");
@@ -53,7 +54,7 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
rateLimit: writeLimit
},
schema: {
- operationId: `create${resourceTypeId}PamAccount`,
+ operationId: `create${parentTypeId}PamAccount`,
description: "Create PAM account",
body: createAccountSchema,
response: {
@@ -64,7 +65,14 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
},
onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => {
- const account = await server.services.pamAccount.create(req.body, req.permission);
+ const account = await server.services.pamAccount.create(
+ {
+ ...req.body,
+ resourceId: req.body.resourceId ?? undefined,
+ domainId: req.body.domainId ?? undefined
+ },
+ req.permission
+ );
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
@@ -74,7 +82,8 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
type: EventType.PAM_ACCOUNT_CREATE,
metadata: {
resourceId: req.body.resourceId,
- resourceType,
+ domainId: req.body.domainId,
+ parentType,
folderId: req.body.folderId,
name: req.body.name,
description: req.body.description,
@@ -89,7 +98,7 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
distinctId: getTelemetryDistinctId(req),
organizationId: req.permission.orgId,
properties: {
- resourceType,
+ parentType,
projectId: account.projectId
}
})
@@ -106,7 +115,7 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
rateLimit: writeLimit
},
schema: {
- operationId: `update${resourceTypeId}PamAccount`,
+ operationId: `update${parentTypeId}PamAccount`,
description: "Update PAM account",
params: z.object({
accountId: z.string().uuid()
@@ -137,7 +146,8 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
metadata: {
accountId: req.params.accountId,
resourceId: account.resourceId,
- resourceType,
+ domainId: account.domainId,
+ parentType,
name: req.body.name,
description: req.body.description,
requireMfa: req.body.requireMfa
@@ -156,7 +166,7 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
rateLimit: writeLimit
},
schema: {
- operationId: `delete${resourceTypeId}PamAccount`,
+ operationId: `delete${parentTypeId}PamAccount`,
description: "Delete PAM account",
params: z.object({
accountId: z.string().uuid()
@@ -181,7 +191,8 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
accountId: req.params.accountId,
accountName: account.name,
resourceId: account.resourceId,
- resourceType
+ domainId: account.domainId,
+ parentType
}
}
});
@@ -192,7 +203,7 @@ export const registerPamAccountEndpoints = <C extends TPamAccount>({
distinctId: getTelemetryDistinctId(req),
organizationId: req.permission.orgId,
properties: {
- resourceType,
+ parentType,
projectId: account.projectId
}
})
diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
index 2e4275c550..3df62afbb0 100644
--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-router.ts
@@ -1,13 +1,14 @@
import type WebSocket from "ws";
import { z } from "zod";
-import { PamAccountDependenciesSchema } from "@app/db/schemas";
+import { PamAccountDependenciesSchema, PamDomainsSchema, PamResourcesSchema } from "@app/db/schemas";
import { AuditLogInfo, EventType, UserAgentType } from "@app/ee/services/audit-log/audit-log-types";
-import { PamAccountOrderBy, PamAccountView } from "@app/ee/services/pam-account/pam-account-enums";
+import { PamAccountOrderBy, PamAccountView, PamParentType } from "@app/ee/services/pam-account/pam-account-enums";
import {
ActiveDirectoryAccountCredentialsSchema,
- SanitizedActiveDirectoryAccountWithResourceSchema
-} from "@app/ee/services/pam-resource/active-directory/active-directory-resource-schemas";
+ SanitizedActiveDirectoryAccountWithDomainSchema
+} from "@app/ee/services/pam-domain/active-directory/active-directory-domain-schemas";
+import { PamDomainType } from "@app/ee/services/pam-domain/pam-domain-enums";
import {
AwsIamAccountCredentialsSchema,
SanitizedAwsIamAccountWithResourceSchema
@@ -58,7 +59,7 @@ import { TokenType } from "@app/services/auth-token/auth-token-types";
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const SanitizedAccountSchema = z
- .discriminatedUnion("resourceType", [
+ .discriminatedUnion("parentType", [
SanitizedKubernetesAccountWithResourceSchema,
SanitizedSSHAccountWithResourceSchema,
SanitizedPostgresAccountWithResourceSchema,
@@ -68,7 +69,7 @@ const SanitizedAccountSchema = z
SanitizedRedisAccountWithResourceSchema,
SanitizedAwsIamAccountWithResourceSchema,
SanitizedWindowsAccountWithResourceSchema,
- SanitizedActiveDirectoryAccountWithResourceSchema
+ SanitizedActiveDirectoryAccountWithDomainSchema
])
.and(
z.object({
@@ -85,49 +86,50 @@ const ListPamAccountsResponseSchema = z.object({
const AccountCredentialsBaseSchema = z.object({
accountId: z.string().uuid(),
accountName: z.string(),
- resourceName: z.string(),
- projectId: z.string().uuid()
+ projectId: z.string().uuid(),
+ resource: PamResourcesSchema.pick({ id: true, name: true, resourceType: true }).nullable().optional(),
+ domain: PamDomainsSchema.pick({ id: true, name: true, domainType: true }).nullable().optional()
});
-const AccountCredentialsResponseSchema = z.discriminatedUnion("resourceType", [
+const AccountCredentialsResponseSchema = z.discriminatedUnion("parentType", [
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.Postgres),
+ parentType: z.literal(PamResource.Postgres),
credentials: PostgresAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.MySQL),
+ parentType: z.literal(PamResource.MySQL),
credentials: MySQLAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.MsSQL),
+ parentType: z.literal(PamResource.MsSQL),
credentials: MsSQLAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.MongoDB),
+ parentType: z.literal(PamResource.MongoDB),
credentials: MongoDBAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.SSH),
- credentials: SSHAccountCredentialsSchema
+ parentType: z.literal(PamResource.Redis),
+ credentials: RedisAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.Redis),
- credentials: RedisAccountCredentialsSchema
+ parentType: z.literal(PamResource.SSH),
+ credentials: SSHAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.Kubernetes),
+ parentType: z.literal(PamResource.Kubernetes),
credentials: KubernetesAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.AwsIam),
+ parentType: z.literal(PamResource.AwsIam),
credentials: AwsIamAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.Windows),
+ parentType: z.literal(PamResource.Windows),
credentials: WindowsAccountCredentialsSchema
}),
AccountCredentialsBaseSchema.extend({
- resourceType: z.literal(PamResource.ActiveDirectory),
+ parentType: z.literal(PamDomainType.ActiveDirectory),
credentials: ActiveDirectoryAccountCredentialsSchema
})
]);
@@ -267,7 +269,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
distinctId: getTelemetryDistinctId(req),
organizationId: req.permission.orgId,
properties: {
- resourceType: account.resourceType,
+ parentType: account.parentType as PamParentType,
projectId: account.projectId
}
})
@@ -359,8 +361,10 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
metadata: {
accountId: result.accountId,
accountName: result.accountName,
- resourceId: result.resourceId,
- resourceType: result.resourceType
+ resourceId: result.resource?.id,
+ resourceType: result.resource?.resourceType,
+ domainId: result.domain?.id,
+ domainType: result.domain?.domainType
}
}
});
@@ -451,6 +455,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
orderDirection: z.nativeEnum(OrderByDirection).default(OrderByDirection.ASC),
search: z.string().trim().optional(),
filterResourceIds: z.array(z.string().uuid()).optional(),
+ filterDomainIds: z.array(z.string().uuid()).optional(),
metadata: z
.array(
z.object({
@@ -466,8 +471,18 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.JWT]),
handler: async (req) => {
- const { projectId, accountView, limit, offset, search, orderBy, orderDirection, filterResourceIds, metadata } =
- req.body;
+ const {
+ projectId,
+ accountView,
+ limit,
+ offset,
+ search,
+ orderBy,
+ orderDirection,
+ filterResourceIds,
+ filterDomainIds,
+ metadata
+ } = req.body;
const { accounts, totalCount } = await server.services.pamAccount.list({
actorId: req.permission.id,
@@ -482,6 +497,7 @@ export const registerPamAccountRouter = async (server: FastifyZodProvider) => {
orderBy,
orderDirection,
filterResourceIds,
+ filterDomainIds,
metadataFilter: metadata
});
diff --git a/backend/src/ee/routes/v1/pam-domain-routers/index.ts b/backend/src/ee/routes/v1/pam-domain-routers/index.ts
new file mode 100644
index 0000000000..ab5f2eb432
--- /dev/null
+++ b/backend/src/ee/routes/v1/pam-domain-routers/index.ts
@@ -0,0 +1,44 @@
+import { registerPamAccountEndpoints } from "@app/ee/routes/v1/pam-account-routers/pam-account-endpoints";
+import {
+ CreateActiveDirectoryAccountSchema,
+ SanitizedActiveDirectoryAccountWithDomainSchema,
+ UpdateActiveDirectoryAccountSchema
+} from "@app/ee/services/pam-domain/active-directory/active-directory-domain-schemas";
+import { PamDomainType } from "@app/ee/services/pam-domain/pam-domain-enums";
+import {
+ CreateActiveDirectoryDomainSchema,
+ SanitizedActiveDirectoryDomainSchema,
+ UpdateActiveDirectoryDomainSchema
+} from "@app/ee/services/pam-domain/pam-domain-schemas";
+
+import { registerActiveDirectoryRelatedResourcesEndpoint, registerPamDomainEndpoints } from "./pam-domain-endpoints";
+
+export { registerPamDomainRouter } from "./pam-domain-router";
+
+export const PAM_DOMAIN_REGISTER_ROUTER_MAP: Record<PamDomainType, (server: FastifyZodProvider) => Promise<void>> = {
+ [PamDomainType.ActiveDirectory]: async (server: FastifyZodProvider) => {
+ registerPamDomainEndpoints({
+ server,
+ domainType: PamDomainType.ActiveDirectory,
+ domainResponseSchema: SanitizedActiveDirectoryDomainSchema,
+ createDomainSchema: CreateActiveDirectoryDomainSchema,
+ updateDomainSchema: UpdateActiveDirectoryDomainSchema
+ });
+ registerActiveDirectoryRelatedResourcesEndpoint(server);
+ }
+};
+
+export const PAM_DOMAIN_ACCOUNT_REGISTER_ROUTER_MAP: Record<
+ PamDomainType,
+ (server: FastifyZodProvider) => Promise<void>
+> = {
+ [PamDomainType.ActiveDirectory]: async (server: FastifyZodProvider) => {
+ registerPamAccountEndpoints({
+ server,
+ parentType: PamDomainType.ActiveDirectory,
+ accountResponseSchema: SanitizedActiveDirectoryAccountWithDomainSchema,
+ createAccountSchema: CreateActiveDirectoryAccountSchema,
+ updateAccountSchema: UpdateActiveDirectoryAccountSchema
+ });
+ }
+};
diff --git a/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-endpoints.ts b/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-endpoints.ts
new file mode 100644
index 0000000000..54b6fbb61c
--- /dev/null
+++ b/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-endpoints.ts
@@ -0,0 +1,220 @@
+import { z } from "zod";
+
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { PamDomainType } from "@app/ee/services/pam-domain/pam-domain-enums";
+import { TPamDomain } from "@app/ee/services/pam-domain/pam-domain-types";
+import { SanitizedWindowsResourceSchema } from "@app/ee/services/pam-resource/windows-server/windows-server-resource-schemas";
+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-metadata/resource-metadata-schema";
+
+export const registerPamDomainEndpoints = <T extends TPamDomain>({
+ server,
+ domainType,
+ createDomainSchema,
+ updateDomainSchema,
+ domainResponseSchema
+}: {
+ server: FastifyZodProvider;
+ domainType: PamDomainType;
+ createDomainSchema: z.ZodType<{
+ projectId: T["projectId"];
+ connectionDetails: T["connectionDetails"];
+ gatewayId?: string;
+ name: T["name"];
+ metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
+ }>;
+ updateDomainSchema: z.ZodType<{
+ connectionDetails?: T["connectionDetails"];
+ gatewayId?: string;
+ name?: T["name"];
+ metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
+ }>;
+ domainResponseSchema: z.ZodTypeAny;
+}) => {
+ const domainTypeId = domainType
+ .split("-")
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
+ .join("");
+
+ server.route({
+ method: "GET",
+ url: "/:domainId",
+ config: { rateLimit: readLimit },
+ schema: {
+ operationId: `get${domainTypeId}PamDomain`,
+ description: `Get ${domainTypeId} PAM domain`,
+ params: z.object({ domainId: z.string().uuid() }),
+ response: {
+ 200: z.object({
+ domain: domainResponseSchema
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const domain = await server.services.pamDomain.getById(req.params.domainId, domainType, req.permission);
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ projectId: domain.projectId,
+ event: {
+ type: EventType.PAM_DOMAIN_GET,
+ metadata: {
+ domainId: domain.id,
+ domainType: domain.domainType,
+ name: domain.name
+ }
+ }
+ });
+
+ return { domain };
+ }
+ });
+
+ server.route({
+ method: "POST",
+ url: "/",
+ config: { rateLimit: writeLimit },
+ schema: {
+ operationId: `create${domainTypeId}PamDomain`,
+ description: `Create ${domainTypeId} PAM domain`,
+ body: createDomainSchema,
+ response: {
+ 200: z.object({
+ domain: domainResponseSchema
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const domain = await server.services.pamDomain.create(
+ {
+ ...req.body,
+ domainType
+ },
+ req.permission
+ );
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ projectId: req.body.projectId,
+ event: {
+ type: EventType.PAM_DOMAIN_CREATE,
+ metadata: {
+ domainType,
+ ...(req.body.gatewayId && { gatewayId: req.body.gatewayId }),
+ name: req.body.name
+ }
+ }
+ });
+
+ return { domain };
+ }
+ });
+
+ server.route({
+ method: "PATCH",
+ url: "/:domainId",
+ config: { rateLimit: writeLimit },
+ schema: {
+ operationId: `update${domainTypeId}PamDomain`,
+ description: `Update ${domainTypeId} PAM domain`,
+ params: z.object({ domainId: z.string().uuid() }),
+ body: updateDomainSchema,
+ response: {
+ 200: z.object({
+ domain: domainResponseSchema
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const domain = await server.services.pamDomain.updateById(
+ {
+ ...req.body,
+ domainId: req.params.domainId
+ },
+ req.permission
+ );
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ projectId: domain.projectId,
+ event: {
+ type: EventType.PAM_DOMAIN_UPDATE,
+ metadata: {
+ domainId: req.params.domainId,
+ domainType,
+ ...(req.body.gatewayId && { gatewayId: req.body.gatewayId }),
+ ...(req.body.name && { name: req.body.name })
+ }
+ }
+ });
+
+ return { domain };
+ }
+ });
+
+ server.route({
+ method: "DELETE",
+ url: "/:domainId",
+ config: { rateLimit: writeLimit },
+ schema: {
+ operationId: `delete${domainTypeId}PamDomain`,
+ description: `Delete ${domainTypeId} PAM domain`,
+ params: z.object({ domainId: z.string().uuid() }),
+ response: {
+ 200: z.object({
+ domain: domainResponseSchema
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const domain = await server.services.pamDomain.deleteById(req.params.domainId, req.permission);
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ projectId: domain.projectId,
+ event: {
+ type: EventType.PAM_DOMAIN_DELETE,
+ metadata: {
+ domainId: req.params.domainId,
+ domainType
+ }
+ }
+ });
+
+ return { domain };
+ }
+ });
+};
+
+export const registerActiveDirectoryRelatedResourcesEndpoint = (server: FastifyZodProvider) => {
+ server.route({
+ method: "GET",
+ url: "/:domainId/related-resources",
+ config: { rateLimit: readLimit },
+ schema: {
+ operationId: "listActiveDirectoryDomainRelatedResources",
+ description: "List resources related to an Active Directory domain",
+ params: z.object({ domainId: z.string().uuid() }),
+ response: {
+ 200: z.object({
+ resources: SanitizedWindowsResourceSchema.array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const resources = await server.services.pamDomain.listRelatedResources(req.params.domainId, req.permission);
+ return { resources };
+ }
+ });
+};
diff --git a/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-router.ts b/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-router.ts
new file mode 100644
index 0000000000..6b88bd8d93
--- /dev/null
+++ b/backend/src/ee/routes/v1/pam-domain-routers/pam-domain-router.ts
@@ -0,0 +1,106 @@
+import { z } from "zod";
+
+import { EventType } from "@app/ee/services/audit-log/audit-log-types";
+import { PamDomainOrderBy } from "@app/ee/services/pam-domain/pam-domain-enums";
+import {
+ ActiveDirectoryDomainListItemSchema,
+ SanitizedDomainSchema
+} from "@app/ee/services/pam-domain/pam-domain-schemas";
+import { OrderByDirection } from "@app/lib/types";
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AuthMode } from "@app/services/auth/auth-type";
+
+const DomainOptionsSchema = z.discriminatedUnion("domain", [ActiveDirectoryDomainListItemSchema]);
+
+export const registerPamDomainRouter = async (server: FastifyZodProvider) => {
+ server.route({
+ method: "GET",
+ url: "/options",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listPamDomainOptions",
+ description: "List available PAM domain types",
+ response: {
+ 200: z.object({
+ options: DomainOptionsSchema.array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: () => {
+ const options = server.services.pamDomain.listDomainOptions();
+ return { options };
+ }
+ });
+
+ server.route({
+ method: "GET",
+ url: "/",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listPamDomains",
+ description: "List PAM domains",
+ querystring: z.object({
+ projectId: z.string().uuid(),
+ search: z.string().optional(),
+ limit: z.coerce.number().int().min(1).max(100).optional(),
+ offset: z.coerce.number().int().min(0).optional(),
+ orderBy: z.nativeEnum(PamDomainOrderBy).default(PamDomainOrderBy.Name),
+ orderDirection: z.nativeEnum(OrderByDirection).default(OrderByDirection.ASC),
+ filterDomainTypes: z
+ .string()
+ .transform((val) =>
+ val
+ .split(",")
+ .map((s) => s.trim())
+ .filter(Boolean)
+ )
+ .optional(),
+ discoveryFingerprint: z.string().optional()
+ }),
+ response: {
+ 200: z.object({
+ domains: SanitizedDomainSchema.array(),
+ totalCount: z.number()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
+ handler: async (req) => {
+ const { projectId, search, limit, offset, orderBy, orderDirection, filterDomainTypes } = req.query;
+
+ const { domains, totalCount } = await server.services.pamDomain.list({
+ projectId,
+ search,
+ limit,
+ offset,
+ orderBy,
+ orderDirection,
+ filterDomainTypes,
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ });
+
+ await server.services.auditLog.createAuditLog({
+ ...req.auditLogInfo,
+ orgId: req.permission.orgId,
+ projectId,
+ event: {
+ type: EventType.PAM_DOMAIN_LIST,
+ metadata: {
+ count: domains.length
+ }
+ }
+ });
+
+ return { domains, totalCount };
+ }
+ });
+};
diff --git a/backend/src/ee/routes/v1/pam-resource-routers/index.ts b/backend/src/ee/routes/v1/pam-resource-routers/index.ts
index 0fdc50ca5c..ef58df57d7 100644
--- a/backend/src/ee/routes/v1/pam-resource-routers/index.ts
+++ b/backend/src/ee/routes/v1/pam-resource-routers/index.ts
@@ -1,8 +1,3 @@
-import {
- CreateActiveDirectoryResourceSchema,
- SanitizedActiveDirectoryResourceSchema,
- UpdateActiveDirectoryResourceSchema
-} from "@app/ee/services/pam-resource/active-directory/active-directory-resource-schemas";
import {
CreateAwsIamResourceSchema,
SanitizedAwsIamResourceSchema,
@@ -51,7 +46,6 @@ import {
} from "@app/ee/services/pam-resource/windows-server/windows-server-resource-schemas";
import {
- registerActiveDirectoryRelatedResourcesEndpoint,
registerPamResourceEndpoints,
registerSshCaPublicKeyEndpoint,
registerSshCaSetupEndpoint
@@ -140,15 +134,5 @@ export const PAM_RESOURCE_REGISTER_ROUTER_MAP: Record<PamResource, (server: Fast
createResourceSchema: CreateWindowsResourceSchema,
updateResourceSchema: UpdateWindowsResourceSchema
});
- },
- [PamResource.ActiveDirectory]: async (server: FastifyZodProvider) => {
- registerPamResourceEndpoints({
- server,
- resourceType: PamResource.ActiveDirectory,
- resourceResponseSchema: SanitizedActiveDirectoryResourceSchema,
- createResourceSchema: CreateActiveDirectoryResourceSchema,
- updateResourceSchema: UpdateActiveDirectoryResourceSchema
- });
- registerActiveDirectoryRelatedResourcesEndpoint(server);
}
};
diff --git a/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-endpoints.ts b/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-endpoints.ts
index a9d89327b9..486a6a13ee 100644
--- a/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-endpoints.ts
+++ b/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-endpoints.ts
@@ -3,7 +3,6 @@ import { z } from "zod";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { PamResource } from "@app/ee/services/pam-resource/pam-resource-enums";
import { TPamResource } from "@app/ee/services/pam-resource/pam-resource-types";
-import { SanitizedWindowsResourceSchema } from "@app/ee/services/pam-resource/windows-server/windows-server-resource-schemas";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -360,31 +359,3 @@ echo ""
}
});
};
-
-export const registerActiveDirectoryRelatedResourcesEndpoint = (server: FastifyZodProvider) => {
- server.route({
- method: "GET",
- url: "/:resourceId/related-resources",
- config: {
- rateLimit: readLimit
- },
- schema: {
- operationId: "getActiveDirectoryRelatedResources",
- description: "List resources that belong to this Active Directory domain",
- params: z.object({
- resourceId: z.string().uuid()
- }),
- response: {
- 200: z.object({
- resources: SanitizedWindowsResourceSchema.array()
- })
- }
- },
- onRequest: verifyAuth([AuthMode.JWT]),
- handler: async (req) => {
- const resources = await server.services.pamResource.listRelatedResources(req.params.resourceId, req.permission);
-
- return { resources };
- }
- });
-};
diff --git a/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-router.ts b/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-router.ts
index 838eb308db..ff3e11bae9 100644
--- a/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-router.ts
+++ b/backend/src/ee/routes/v1/pam-resource-routers/pam-resource-router.ts
@@ -2,10 +2,6 @@ import { z } from "zod";
import { PamAccountDependenciesSchema } from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
-import {
- ActiveDirectoryResourceListItemSchema,
- SanitizedActiveDirectoryResourceSchema
-} from "@app/ee/services/pam-resource/active-directory/active-directory-resource-schemas";
import {
AwsIamResourceListItemSchema,
SanitizedAwsIamResourceSchema
@@ -57,8 +53,7 @@ const SanitizedResourceSchema = z.discriminatedUnion("resourceType", [
SanitizedAwsIamResourceSchema,
SanitizedMongoDBResourceSchema,
SanitizedRedisResourceSchema,
- SanitizedWindowsResourceSchema,
- SanitizedActiveDirectoryResourceSchema
+ SanitizedWindowsResourceSchema
]);
const SanitizedResourceWithFavoriteSchema = z.intersection(
@@ -75,8 +70,7 @@ const ResourceOptionsSchema = z.discriminatedUnion("resource", [
AwsIamResourceListItemSchema,
MongoDBResourceListItemSchema,
RedisResourceListItemSchema,
- WindowsResourceListItemSchema,
- ActiveDirectoryResourceListItemSchema
+ WindowsResourceListItemSchema
]);
export const registerPamResourceRouter = async (server: FastifyZodProvider) => {
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 3e0144513e..6a31277e86 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -1,4 +1,5 @@
import { ProjectType } from "@app/db/schemas";
+import { PamParentType } from "@app/ee/services/pam-account/pam-account-enums";
import {
TCreateProjectTemplateDTO,
TUpdateProjectTemplateDTO
@@ -614,6 +615,11 @@ export enum EventType {
PAM_RESOURCE_CREATE = "pam-resource-create",
PAM_RESOURCE_UPDATE = "pam-resource-update",
PAM_RESOURCE_DELETE = "pam-resource-delete",
+ PAM_DOMAIN_LIST = "pam-domain-list",
+ PAM_DOMAIN_GET = "pam-domain-get",
+ PAM_DOMAIN_CREATE = "pam-domain-create",
+ PAM_DOMAIN_UPDATE = "pam-domain-update",
+ PAM_DOMAIN_DELETE = "pam-domain-delete",
PAM_DISCOVERY_SOURCE_LIST = "pam-discovery-source-list",
PAM_DISCOVERY_SOURCE_GET = "pam-discovery-source-get",
PAM_DISCOVERY_SOURCE_CREATE = "pam-discovery-source-create",
@@ -4810,8 +4816,9 @@ interface PamWebAccessSessionTicketCreatedEvent {
interface PamAccountCreateEvent {
type: EventType.PAM_ACCOUNT_CREATE;
metadata: {
- resourceId: string;
- resourceType: string;
+ resourceId?: string | null;
+ domainId?: string | null;
+ parentType: PamParentType;
folderId?: string | null;
name: string;
description?: string | null;
@@ -4823,8 +4830,9 @@ interface PamAccountUpdateEvent {
type: EventType.PAM_ACCOUNT_UPDATE;
metadata: {
accountId: string;
- resourceId: string;
- resourceType: string;
+ resourceId?: string | null;
+ domainId?: string | null;
+ parentType: PamParentType;
name?: string;
description?: string | null;
requireMfa?: boolean | null;
@@ -4836,8 +4844,9 @@ interface PamAccountDeleteEvent {
metadata: {
accountName: string;
accountId: string;
- resourceId: string;
- resourceType: string;
+ resourceId?: string | null;
+ domainId?: string | null;
+ parentType: PamParentType;
};
}
@@ -4867,8 +4876,10 @@ interface PamAccountReadCredentialsEvent {
metadata: {
accountId: string;
accountName: string;
- resourceId: string;
- resourceType: string;
+ resourceId?: string | null;
+ resourceType?: string | null;
+ domainId?: string | null;
+ domainType?: string | null;
};
}
@@ -4915,6 +4926,49 @@ interface PamResourceDeleteEvent {
};
}
+interface PamDomainListEvent {
+ type: EventType.PAM_DOMAIN_LIST;
+ metadata: {
+ count: number;
+ };
+}
+
+interface PamDomainGetEvent {
+ type: EventType.PAM_DOMAIN_GET;
+ metadata: {
+ domainId: string;
+ domainType: string;
+ name: string;
+ };
+}
+
+interface PamDomainCreateEvent {
+ type: EventType.PAM_DOMAIN_CREATE;
+ metadata: {
+ domainType: string;
+ gatewayId?: string;
+ name: string;
+ };
+}
+
+interface PamDomainUpdateEvent {
+ type: EventType.PAM_DOMAIN_UPDATE;
+ metadata: {
+ domainId: string;
+ domainType: string;
+ gatewayId?: string;
+ name?: string;
+ };
+}
+
+interface PamDomainDeleteEvent {
+ type: EventType.PAM_DOMAIN_DELETE;
+ metadata: {
+ domainId: string;
+ domainType: string;
+ };
+}
+
interface PamDiscoverySourceListEvent {
type: EventType.PAM_DISCOVERY_SOURCE_LIST;
metadata: {
@@ -6181,6 +6235,11 @@ export type Event =
| PamResourceCreateEvent
| PamResourceUpdateEvent
| PamResourceDeleteEvent
+ | PamDomainListEvent
+ | PamDomainGetEvent
+ | PamDomainCreateEvent
+ | PamDomainUpdateEvent
+ | PamDomainDeleteEvent
| PamDiscoverySourceListEvent
| PamDiscoverySourceGetEvent
| PamDiscoverySourceCreateEvent
diff --git a/backend/src/ee/services/pam-account/pam-account-dal.ts b/backend/src/ee/services/pam-account/pam-account-dal.ts
index fedf2ac2ab..491cec74fe 100644
--- a/backend/src/ee/services/pam-account/pam-account-dal.ts
+++ b/backend/src/ee/services/pam-account/pam-account-dal.ts
@@ -15,7 +15,7 @@ export type TPamAccountDALFactory = ReturnType<typeof pamAccountDALFactory>;
export const pamAccountDALFactory = (db: TDbClient) => {
const orm = ormify(db, TableName.PamAccount);
- const findByProjectIdWithResourceDetails = async (
+ const findByProjectIdWithParentDetails = async (
{
projectId,
folderId,
@@ -26,6 +26,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {
orderBy = PamAccountOrderBy.Name,
orderDirection = OrderByDirection.ASC,
filterResourceIds,
+ filterDomainIds,
metadataFilter
}: {
projectId: string;
@@ -37,6 +38,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {
orderBy?: PamAccountOrderBy;
orderDirection?: OrderByDirection;
filterResourceIds?: string[];
+ filterDomainIds?: string[];
metadataFilter?: Array<{ key: string; value?: string }>;
},
tx?: Knex
@@ -45,6 +47,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {
const dbInstance = tx || db.replicaNode();
const query = dbInstance(TableName.PamAccount)
.leftJoin(TableName.PamResource, `${TableName.PamAccount}.resourceId`, `${TableName.PamResource}.id`)
+ .leftJoin(TableName.PamDomain, `${TableName.PamAccount}.domainId`, `${TableName.PamDomain}.id`)
.where(`${TableName.PamAccount}.projectId`, projectId);
if (accountView === PamAccountView.Nested) {
@@ -66,12 +69,24 @@ export const pamAccountDALFactory = (db: TDbClient) => {
void q
.whereRaw(`??.?? ILIKE ? ESCAPE '\\'`, [TableName.PamAccount, "name", pattern])
.orWhereRaw(`??.?? ILIKE ? ESCAPE '\\'`, [TableName.PamResource, "name", pattern])
+ .orWhereRaw(`??.?? ILIKE ? ESCAPE '\\'`, [TableName.PamDomain, "name", pattern])
.orWhereRaw(`??.?? ILIKE ? ESCAPE '\\'`, [TableName.PamAccount, "description", pattern]);
});
}
- if (filterResourceIds && filterResourceIds.length) {
+ const hasResourceFilter = filterResourceIds && filterResourceIds.length > 0;
+ const hasDomainFilter = filterDomainIds && filterDomainIds.length > 0;
+
+ if (hasResourceFilter && hasDomainFilter) {
+ void query.where((qb) => {
+ void qb
+ .whereIn(`${TableName.PamAccount}.resourceId`, filterResourceIds)
+ .orWhereIn(`${TableName.PamAccount}.domainId`, filterDomainIds);
+ });
+ } else if (hasResourceFilter) {
void query.whereIn(`${TableName.PamAccount}.resourceId`, filterResourceIds);
+ } else if (hasDomainFilter) {
+ void query.whereIn(`${TableName.PamAccount}.domainId`, filterDomainIds);
}
if (metadataFilter && metadataFilter.length > 0) {
@@ -81,10 +96,20 @@ export const pamAccountDALFactory = (db: TDbClient) => {
const countQuery = query.clone().count("*", { as: "count" }).first();
void query.select(selectAllTableCols(TableName.PamAccount)).select(
- // resource
+ // resource (may be null for domain accounts)
db.ref("name").withSchema(TableName.PamResource).as("resourceName"),
db.ref("resourceType").withSchema(TableName.PamResource),
- db.ref("encryptedRotationAccountCredentials").withSchema(TableName.PamResource)
+ db
+ .ref("encryptedRotationAccountCredentials")
+ .withSchema(TableName.PamResource)
+ .as("resourceEncryptedRotationAccountCredentials"),
+ // domain (may be null for resource accounts)
+ db.ref("name").withSchema(TableName.PamDomain).as("domainName"),
+ db.ref("domainType").withSchema(TableName.PamDomain),
+ db
+ .ref("encryptedRotationAccountCredentials")
+ .withSchema(TableName.PamDomain)
+ .as("domainEncryptedRotationAccountCredentials")
);
const direction = orderDirection === OrderByDirection.ASC ? "ASC" : "DESC";
@@ -98,60 +123,103 @@ export const pamAccountDALFactory = (db: TDbClient) => {
const [results, countResult] = await Promise.all([query, countQuery]);
const totalCount = Number(countResult?.count || 0);
- const accounts = results.map(
- // @ts-expect-error resourceName, resourceType, encryptedRotationAccountCredentials are from joined table
- ({ resourceId, resourceName, resourceType, encryptedRotationAccountCredentials, ...account }) => ({
- ...account,
- resourceId,
- resource: {
- id: resourceId,
- name: resourceName as string,
- resourceType,
- encryptedRotationAccountCredentials
- }
- })
- );
+ const accounts = results.map((row) => {
+ const r = row as Record<string, unknown>;
+ const rId = row.resourceId as string | null;
+ const dId = row.domainId as string | null;
+
+ return {
+ ...row,
+ resourceId: rId,
+ domainId: dId,
+ resource: rId
+ ? {
+ id: rId,
+ name: r.resourceName as string,
+ resourceType: r.resourceType as string,
+ encryptedRotationAccountCredentials: r.resourceEncryptedRotationAccountCredentials as Buffer | null
+ }
+ : null,
+ domain: dId
+ ? {
+ id: dId,
+ name: r.domainName as string,
+ domainType: r.domainType as string,
+ encryptedRotationAccountCredentials: r.domainEncryptedRotationAccountCredentials as Buffer | null
+ }
+ : null
+ };
+ });
+
return { accounts, totalCount };
} catch (error) {
- throw new DatabaseError({ error, name: "Find PAM accounts with resource details" });
+ throw new DatabaseError({ error, name: "Find PAM accounts with parent details" });
}
};
- const findByIdWithResourceDetails = async (accountId: string, tx?: Knex) => {
+ const findByIdWithParentDetails = async (accountId: string, tx?: Knex) => {
try {
const dbInstance = tx || db.replicaNode();
const result = await dbInstance(TableName.PamAccount)
.leftJoin(TableName.PamResource, `${TableName.PamAccount}.resourceId`, `${TableName.PamResource}.id`)
+ .leftJoin(TableName.PamDomain, `${TableName.PamAccount}.domainId`, `${TableName.PamDomain}.id`)
.where(`${TableName.PamAccount}.id`, accountId)
.select(selectAllTableCols(TableName.PamAccount))
.select(
+ // resource (may be null for domain accounts)
db.ref("name").withSchema(TableName.PamResource).as("resourceName"),
db.ref("resourceType").withSchema(TableName.PamResource),
- db.ref("encryptedRotationAccountCredentials").withSchema(TableName.PamResource)
+ db
+ .ref("encryptedRotationAccountCredentials")
+ .withSchema(TableName.PamResource)
+ .as("resourceEncryptedRotationAccountCredentials"),
+ // domain (may be null for resource accounts)
+ db.ref("name").withSchema(TableName.PamDomain).as("domainName"),
+ db.ref("domainType").withSchema(TableName.PamDomain),
+ db
+ .ref("encryptedRotationAccountCredentials")
+ .withSchema(TableName.PamDomain)
+ .as("domainEncryptedRotationAccountCredentials")
)
.first();
if (!result) return null;
- const { resourceId, resourceName, resourceType, encryptedRotationAccountCredentials, ...account } = result as {
- resourceId: string;
- resourceName: string;
- resourceType: string;
- encryptedRotationAccountCredentials: Buffer | null;
- } & typeof result;
+ const {
+ resourceId,
+ domainId,
+ resourceName,
+ resourceType,
+ resourceEncryptedRotationAccountCredentials,
+ domainName,
+ domainType,
+ domainEncryptedRotationAccountCredentials,
+ ...account
+ } = result;
return {
...account,
resourceId,
- resource: {
- id: resourceId,
- name: resourceName,
- resourceType,
- encryptedRotationAccountCredentials
- }
+ domainId,
+ resource: resourceId
+ ? {
+ id: resourceId,
+ name: resourceName,
+ resourceType,
+ encryptedRotationAccountCredentials: resourceEncryptedRotationAccountCredentials
+ }
+ : null,
+ domain: domainId
+ ? {
+ id: domainId,
+ name: domainName,
+ domainType,
+ encryptedRotationAccountCredentials: domainEncryptedRotationAccountCredentials
+ }
+ : null
};
} catch (error) {
- throw new DatabaseError({ error, name: "Find PAM account by ID with resource details" });
+ throw new DatabaseError({ error, name: "Find PAM account by ID with parent details" });
}
};
@@ -170,14 +238,34 @@ export const pamAccountDALFactory = (db: TDbClient) => {
return byAccountId;
};
- const findRotationCandidates = async (resourceIds: string[], minIntervalSeconds: number, tx?: Knex) => {
- if (!resourceIds.length) return [];
+ const findRotationCandidates = async (
+ {
+ resourceIds,
+ domainIds,
+ minIntervalSeconds
+ }: {
+ resourceIds?: string[];
+ domainIds?: string[];
+ minIntervalSeconds: number;
+ },
+ tx?: Knex
+ ) => {
+ const hasResourceIds = resourceIds && resourceIds.length > 0;
+ const hasDomainIds = domainIds && domainIds.length > 0;
+ if (!hasResourceIds && !hasDomainIds) return [];
try {
const cutoff = new Date(Date.now() - minIntervalSeconds * 1000);
return await (tx || db.replicaNode())(TableName.PamAccount)
- .whereIn("resourceId", resourceIds)
+ .where((qb) => {
+ if (hasResourceIds) {
+ void qb.whereIn("resourceId", resourceIds);
+ }
+ if (hasDomainIds) {
+ void qb.orWhereIn("domainId", domainIds);
+ }
+ })
.where((qb) => {
void qb.whereNot("rotationStatus", "rotating").orWhereNull("rotationStatus");
})
@@ -194,8 +282,8 @@ export const pamAccountDALFactory = (db: TDbClient) => {
return {
...orm,
- findByProjectIdWithResourceDetails,
- findByIdWithResourceDetails,
+ findByProjectIdWithParentDetails,
+ findByIdWithParentDetails,
findMetadataByAccountIds,
findRotationCandidates
};
diff --git a/backend/src/ee/services/pam-account/pam-account-enums.ts b/backend/src/ee/services/pam-account/pam-account-enums.ts
index 0c39e81bb6..dbaddeab20 100644
--- a/backend/src/ee/services/pam-account/pam-account-enums.ts
+++ b/backend/src/ee/services/pam-account/pam-account-enums.ts
@@ -1,3 +1,8 @@
+import { PamDomainType } from "../pam-domain/pam-domain-enums";
+import { PamResource } from "../pam-resource/pam-resource-enums";
+
+export type PamParentType = PamResource | PamDomainType;
+
export enum PamAccountOrderBy {
Name = "name"
}
diff --git a/backend/src/ee/services/pam-account/pam-account-fns.ts b/backend/src/ee/services/pam-account/pam-account-fns.ts
index 679710e0ba..2edd336761 100644
--- a/backend/src/ee/services/pam-account/pam-account-fns.ts
+++ b/backend/src/ee/services/pam-account/pam-account-fns.ts
@@ -69,11 +69,11 @@ export const decryptAccountMessage = async ({
};
// Returns false for account types where all credential fields are already visible in the sanitized view
-export const hasSensitiveCredentials = (resourceType: string, credentials: TPamAccountCredentials): boolean => {
- if (resourceType === PamResource.AwsIam) return false;
- if (resourceType === PamResource.Kubernetes) return false;
+export const hasSensitiveCredentials = (parentType: string, credentials: TPamAccountCredentials): boolean => {
+ if (parentType === PamResource.AwsIam) return false;
+ if (parentType === PamResource.Kubernetes) return false;
if (
- resourceType === PamResource.SSH &&
+ parentType === PamResource.SSH &&
"authMethod" in credentials &&
credentials.authMethod === SSHAuthMethod.Certificate
)
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index 28b8bdcc54..d2107c023b 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -2,6 +2,7 @@ import { ForbiddenError, subject } from "@casl/ability";
import picomatch from "picomatch";
import { ActionProjectType, OrganizationActionScope, TableName, TPamAccounts, TPamResources } from "@app/db/schemas";
+import { decryptDomainConnectionDetails } from "@app/ee/services/pam-domain/pam-domain-fns";
import {
extractAwsAccountIdFromArn,
generateConsoleFederationUrl,
@@ -53,6 +54,9 @@ import { TUserDALFactory } from "@app/services/user/user-dal";
import { EventType, TAuditLogServiceFactory } from "../audit-log/audit-log-types";
import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
import { TPamAccountDependenciesDALFactory } from "../pam-discovery/pam-account-dependencies-dal";
+import { TPamDomainDALFactory } from "../pam-domain/pam-domain-dal";
+import { PamDomainType } from "../pam-domain/pam-domain-enums";
+import { PAM_DOMAIN_FACTORY_MAP } from "../pam-domain/pam-domain-factory";
import { TPamResourceDALFactory } from "../pam-resource/pam-resource-dal";
import { PamResource } from "../pam-resource/pam-resource-enums";
import { TPamResourceRotationRulesDALFactory } from "../pam-resource/pam-resource-rotation-rules-dal";
@@ -82,6 +86,7 @@ import {
type TPamAccountServiceFactoryDep = {
pamResourceDAL: TPamResourceDALFactory;
+ pamDomainDAL: TPamDomainDALFactory;
pamSessionDAL: TPamSessionDALFactory;
pamAccountDAL: TPamAccountDALFactory;
pamResourceRotationRulesDAL: Pick<TPamResourceRotationRulesDALFactory, "findByResourceIds">;
@@ -114,6 +119,7 @@ const ROTATION_CONCURRENCY_LIMIT = 10;
export const pamAccountServiceFactory = ({
pamResourceDAL,
+ pamDomainDAL,
pamSessionDAL,
pamAccountDAL,
pamResourceRotationRulesDAL,
@@ -131,60 +137,123 @@ export const pamAccountServiceFactory = ({
resourceMetadataDAL,
pamAccountDependenciesDAL
}: TPamAccountServiceFactoryDep) => {
+ // Helper to resolve account parent (resource or domain)
+ const resolveAccountParent = async ({
+ resourceId,
+ domainId
+ }: {
+ resourceId?: string | null;
+ domainId?: string | null;
+ }) => {
+ if (resourceId) {
+ const resource = await pamResourceDAL.findById(resourceId);
+ if (!resource) throw new NotFoundError({ message: `Resource with ID '${resourceId}' not found` });
+ return {
+ projectId: resource.projectId,
+ name: resource.name,
+ resourceType: resource.resourceType,
+ domainType: null as string | null,
+ gatewayId: resource.gatewayId,
+ encryptedConnectionDetails: resource.encryptedConnectionDetails,
+ encryptedResourceMetadata: resource.encryptedResourceMetadata,
+ encryptedRotationAccountCredentials: resource.encryptedRotationAccountCredentials,
+ isResource: true as const,
+ raw: resource
+ };
+ }
+ if (!domainId) throw new BadRequestError({ message: "Either resourceId or domainId must be provided" });
+ const domain = await pamDomainDAL.findById(domainId);
+ if (!domain) throw new NotFoundError({ message: `Domain with ID '${domainId}' not found` });
+ return {
+ projectId: domain.projectId,
+ name: domain.name,
+ resourceType: null as string | null,
+ domainType: domain.domainType,
+ gatewayId: domain.gatewayId,
+ encryptedConnectionDetails: domain.encryptedConnectionDetails,
+ encryptedResourceMetadata: null as Buffer | null,
+ encryptedRotationAccountCredentials: null as Buffer | null,
+ isResource: false as const,
+ raw: domain
+ };
+ };
+
const create = async (
- { credentials, resourceId, name, description, folderId, requireMfa, internalMetadata, metadata }: TCreateAccountDTO,
+ {
+ credentials,
+ resourceId,
+ domainId,
+ name,
+ description,
+ folderId,
+ requireMfa,
+ internalMetadata,
+ metadata
+ }: TCreateAccountDTO,
actor: OrgServiceActor
) => {
- const resource = await pamResourceDAL.findById(resourceId);
- if (!resource) throw new NotFoundError({ message: `Resource with ID '${resourceId}' not found` });
+ const parent = await resolveAccountParent({ resourceId, domainId });
const { permission } = await permissionService.getProjectPermission({
actor: actor.type,
actorAuthMethod: actor.authMethod,
actorId: actor.id,
actorOrgId: actor.orgId,
- projectId: resource.projectId,
+ projectId: parent.projectId,
actionProjectType: ActionProjectType.PAM
});
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.Create,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: resource.name,
accountName: name,
- resourceType: resource.resourceType,
+ ...(parent.isResource && { resourceName: parent.name, resourceType: parent.resourceType }),
+ ...(!parent.isResource && { domainName: parent.name, domainType: parent.domainType }),
metadata: (metadata || []).map(({ key, value }) => ({ key, value: value ?? "" }))
})
);
- const connectionDetails = await decryptResourceConnectionDetails({
- projectId: resource.projectId,
- encryptedConnectionDetails: resource.encryptedConnectionDetails,
- kmsService
- });
-
- // Decrypt resource metadata if available
- const resourceInternalMetadata = resource.encryptedResourceMetadata
- ? await decryptResourceMetadata({
- encryptedMetadata: resource.encryptedResourceMetadata,
- projectId: resource.projectId,
- kmsService
- })
- : undefined;
-
- const factory = PAM_RESOURCE_FACTORY_MAP[resource.resourceType as PamResource](
- resource.resourceType as PamResource,
- connectionDetails,
- resource.gatewayId,
- gatewayV2Service,
- resource.projectId,
- resourceInternalMetadata
- );
+ let factory;
+ if (parent.isResource) {
+ const connectionDetails = await decryptResourceConnectionDetails({
+ projectId: parent.projectId,
+ encryptedConnectionDetails: parent.encryptedConnectionDetails,
+ kmsService
+ });
+ const resourceInternalMetadata = parent.encryptedResourceMetadata
+ ? await decryptResourceMetadata({
+ encryptedMetadata: parent.encryptedResourceMetadata,
+ projectId: parent.projectId,
+ kmsService
+ })
+ : undefined;
+ factory = PAM_RESOURCE_FACTORY_MAP[parent.resourceType as PamResource](
+ parent.resourceType as PamResource,
+ connectionDetails,
+ parent.gatewayId,
+ gatewayV2Service,
+ parent.projectId,
+ resourceInternalMetadata
+ );
+ } else {
+ const connectionDetails = await decryptDomainConnectionDetails({
+ projectId: parent.projectId,
+ encryptedConnectionDetails: parent.encryptedConnectionDetails,
+ kmsService
+ });
+ factory = PAM_DOMAIN_FACTORY_MAP[parent.domainType as PamDomainType](
+ parent.domainType as PamDomainType,
+ connectionDetails,
+ parent.gatewayId,
+ gatewayV2Service,
+ parent.projectId
+ );
+ }
const validatedCredentials = await factory.validateAccountCredentials(credentials);
const encryptedCredentials = await encryptAccountCredentials({
credentials: validatedCredentials,
- projectId: resource.projectId,
+ projectId: parent.projectId,
kmsService
});
@@ -192,8 +261,9 @@ export const pamAccountServiceFactory = ({
const { account, insertedMetadata } = await pamAccountDAL.transaction(async (tx) => {
const newAccount = await pamAccountDAL.create(
{
- projectId: resource.projectId,
- resourceId: resource.id,
+ projectId: parent.projectId,
+ resourceId: resourceId || null,
+ domainId: domainId || null,
encryptedCredentials,
name,
description,
@@ -221,20 +291,29 @@ export const pamAccountServiceFactory = ({
});
return {
- ...(await decryptAccount(account, resource.projectId, kmsService)),
+ ...(await decryptAccount(account, parent.projectId, kmsService)),
+ parentType: (parent.resourceType || parent.domainType)!,
metadata: insertedMetadata?.map(({ id, key, value }) => ({ id, key, value: value ?? "" })) ?? [],
- resourceType: resource.resourceType,
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
- }
+ resource: parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ resourceType: parent.resourceType,
+ rotationCredentialsConfigured: !!parent.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: !parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ domainType: parent.domainType
+ }
+ : null
};
} catch (err) {
if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
throw new BadRequestError({
- message: `Account with name '${name}' already exists for this resource`
+ message: `Account with name '${name}' already exists`
});
}
@@ -249,8 +328,8 @@ export const pamAccountServiceFactory = ({
const account = await pamAccountDAL.findById(accountId);
if (!account) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
- const resource = await pamResourceDAL.findById(account.resourceId);
- if (!resource) throw new NotFoundError({ message: `Resource with ID '${account.resourceId}' not found` });
+ const parent = await resolveAccountParent(account);
+ const resource = parent.isResource ? (parent.raw as TPamResources) : null;
const { permission } = await permissionService.getProjectPermission({
actor: actor.type,
@@ -268,9 +347,9 @@ export const pamAccountServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.Edit,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: resource.name,
accountName: account.name,
- resourceType: resource.resourceType,
+ ...(parent.isResource && { resourceName: parent.name, resourceType: parent.resourceType }),
+ ...(!parent.isResource && { domainName: parent.name, domainType: parent.domainType }),
metadata: currentMetadata
})
);
@@ -280,9 +359,9 @@ export const pamAccountServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.Edit,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: resource.name,
accountName: name ?? account.name,
- resourceType: resource.resourceType,
+ ...(parent.isResource && { resourceName: parent.name, resourceType: parent.resourceType }),
+ ...(!parent.isResource && { domainName: parent.name, domainType: parent.domainType }),
metadata: metadata ? metadata.map(({ key, value }) => ({ key, value: value ?? "" })) : currentMetadata
})
);
@@ -307,29 +386,42 @@ export const pamAccountServiceFactory = ({
}
if (credentials !== undefined) {
- const connectionDetails = await decryptResourceConnectionDetails({
- projectId: account.projectId,
- encryptedConnectionDetails: resource.encryptedConnectionDetails,
- kmsService
- });
-
- // Decrypt resource metadata if available
- const resourceInternalMetadata = resource.encryptedResourceMetadata
- ? await decryptResourceMetadata({
- encryptedMetadata: resource.encryptedResourceMetadata,
- projectId: account.projectId,
- kmsService
- })
- : undefined;
-
- const factory = PAM_RESOURCE_FACTORY_MAP[resource.resourceType as PamResource](
- resource.resourceType as PamResource,
- connectionDetails,
- resource.gatewayId,
- gatewayV2Service,
- account.projectId,
- resourceInternalMetadata
- );
+ let factory;
+ if (parent.isResource) {
+ const connectionDetails = await decryptResourceConnectionDetails({
+ projectId: account.projectId,
+ encryptedConnectionDetails: parent.encryptedConnectionDetails,
+ kmsService
+ });
+ const resourceInternalMetadata = parent.encryptedResourceMetadata
+ ? await decryptResourceMetadata({
+ encryptedMetadata: parent.encryptedResourceMetadata,
+ projectId: account.projectId,
+ kmsService
+ })
+ : undefined;
+ factory = PAM_RESOURCE_FACTORY_MAP[parent.resourceType as PamResource](
+ parent.resourceType as PamResource,
+ connectionDetails,
+ parent.gatewayId,
+ gatewayV2Service,
+ account.projectId,
+ resourceInternalMetadata
+ );
+ } else {
+ const connectionDetails = await decryptDomainConnectionDetails({
+ projectId: account.projectId,
+ encryptedConnectionDetails: parent.encryptedConnectionDetails,
+ kmsService
+ });
+ factory = PAM_DOMAIN_FACTORY_MAP[parent.domainType as PamDomainType](
+ parent.domainType as PamDomainType,
+ connectionDetails,
+ parent.gatewayId,
+ gatewayV2Service,
+ account.projectId
+ );
+ }
const decryptedCredentials = await decryptAccountCredentials({
encryptedCredentials: account.encryptedCredentials,
@@ -357,14 +449,23 @@ export const pamAccountServiceFactory = ({
const existingMeta = await pamAccountDAL.findMetadataByAccountIds([accountId]);
return {
...(await decryptAccount(account, account.projectId, kmsService)),
+ parentType: resource?.resourceType || (!parent.isResource ? parent.domainType : "") || "",
metadata: existingMeta[accountId] || [],
- resourceType: resource.resourceType,
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
- }
+ resource: resource
+ ? {
+ id: resource.id,
+ name: resource.name,
+ resourceType: resource.resourceType,
+ rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: !parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ domainType: parent.domainType
+ }
+ : null
};
}
@@ -394,14 +495,23 @@ export const pamAccountServiceFactory = ({
return {
...(await decryptAccount(updatedAccount, account.projectId, kmsService)),
+ parentType: resource?.resourceType || (!parent.isResource ? parent.domainType : "") || "",
metadata: freshMeta[accountId] || [],
- resourceType: resource.resourceType,
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
- }
+ resource: resource
+ ? {
+ id: resource.id,
+ name: resource.name,
+ resourceType: resource.resourceType,
+ rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: !parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ domainType: parent.domainType
+ }
+ : null
};
} catch (err) {
if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
@@ -418,8 +528,7 @@ export const pamAccountServiceFactory = ({
const account = await pamAccountDAL.findById(id);
if (!account) throw new NotFoundError({ message: `Account with ID '${id}' not found` });
- const resource = await pamResourceDAL.findById(account.resourceId);
- if (!resource) throw new NotFoundError({ message: `Resource with ID '${account.resourceId}' not found` });
+ const parent = await resolveAccountParent(account);
const { permission } = await permissionService.getProjectPermission({
actor: actor.type,
@@ -435,9 +544,9 @@ export const pamAccountServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.Delete,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: resource.name,
accountName: account.name,
- resourceType: resource.resourceType,
+ ...(parent.isResource && { resourceName: parent.name, resourceType: parent.resourceType }),
+ ...(!parent.isResource && { domainName: parent.name, domainType: parent.domainType }),
metadata: accountMeta[id] || []
})
);
@@ -446,13 +555,22 @@ export const pamAccountServiceFactory = ({
return {
...(await decryptAccount(deletedAccount, account.projectId, kmsService)),
- resourceType: resource.resourceType,
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
- }
+ parentType: (parent.resourceType || parent.domainType)!,
+ resource: parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ resourceType: parent.resourceType,
+ rotationCredentialsConfigured: !!parent.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: !parent.isResource
+ ? {
+ id: parent.raw.id,
+ name: parent.name,
+ domainType: parent.domainType
+ }
+ : null
};
};
@@ -477,58 +595,75 @@ export const pamAccountServiceFactory = ({
const limit = params.limit || 20;
const offset = params.offset || 0;
- const { accounts: accountsWithResourceDetails, totalCount } =
- await pamAccountDAL.findByProjectIdWithResourceDetails({
- projectId,
- accountView,
- offset,
- limit,
- search: params.search,
- orderBy: params.orderBy,
- orderDirection: params.orderDirection,
- filterResourceIds: params.filterResourceIds,
- metadataFilter: params.metadataFilter
- });
+ const { accounts: accountsWithParentDetails, totalCount } = await pamAccountDAL.findByProjectIdWithParentDetails({
+ projectId,
+ accountView,
+ offset,
+ limit,
+ search: params.search,
+ orderBy: params.orderBy,
+ orderDirection: params.orderDirection,
+ filterResourceIds: params.filterResourceIds,
+ filterDomainIds: params.filterDomainIds,
+ metadataFilter: params.metadataFilter
+ });
const decryptedAndPermittedAccounts: Array<
Omit<TPamAccounts, "encryptedCredentials" | "encryptedLastRotationMessage"> & {
- resource: Pick<TPamResources, "id" | "name" | "resourceType"> & { rotationCredentialsConfigured: boolean };
+ resource:
+ | (Pick<TPamResources, "id" | "name" | "resourceType"> & { rotationCredentialsConfigured: boolean })
+ | null;
+ domain: { id: string; name: string; domainType: string } | null;
credentials: TPamAccountCredentials;
lastRotationMessage: string | null;
- resourceType: string;
}
> = [];
// Fetch metadata for all accounts before permission loop
- const allAccountIds = accountsWithResourceDetails.map((a) => a.id);
+ const allAccountIds = accountsWithParentDetails.map((a) => a.id);
const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds(allAccountIds);
- for await (const account of accountsWithResourceDetails) {
- // Check permission for each individual account
+ for await (const account of accountsWithParentDetails) {
if (
permission.can(
ProjectPermissionPamAccountActions.Read,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: account.resource.name,
accountName: account.name,
- resourceType: account.resource.resourceType,
+ ...(account.resource && {
+ resourceName: account.resource.name,
+ resourceType: account.resource.resourceType
+ }),
+ ...(account.domain && { domainName: account.domain.name, domainType: account.domain.domainType }),
metadata: metadataByAccountId[account.id] || []
})
)
) {
// Decrypt the account only if the user has permission to read it
- const decryptedAccount = await decryptAccount(account, account.projectId, kmsService);
+ const decryptedAccount = await decryptAccount(
+ account as Parameters<typeof decryptAccount>[0],
+ account.projectId,
+ kmsService
+ );
decryptedAndPermittedAccounts.push({
...decryptedAccount,
- resourceType: account.resource.resourceType,
- resource: {
- id: account.resource.id,
- name: account.resource.name,
- resourceType: account.resource.resourceType,
- rotationCredentialsConfigured: !!account.resource.encryptedRotationAccountCredentials
- }
- });
+ parentType: account.resource?.resourceType || account.domain?.domainType || "",
+ resource: account.resource
+ ? {
+ id: account.resource.id,
+ name: account.resource.name,
+ resourceType: account.resource.resourceType,
+ rotationCredentialsConfigured: !!account.resource.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: account.domain
+ ? {
+ id: account.domain.id,
+ name: account.domain.name,
+ domainType: account.domain.domainType
+ }
+ : null
+ } as unknown as (typeof decryptedAndPermittedAccounts)[0]);
}
}
@@ -548,43 +683,58 @@ export const pamAccountServiceFactory = ({
};
const getById = async ({ accountId, actor, actorId, actorAuthMethod, actorOrgId }: TGetAccountByIdDTO) => {
- const accountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
- if (!accountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const accountWithParent = await pamAccountDAL.findByIdWithParentDetails(accountId);
+ if (!accountWithParent) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
- projectId: accountWithResource.projectId,
+ projectId: accountWithParent.projectId,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.PAM
});
- const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithResource.id]);
- const accountMetadata = metadataByAccountId[accountWithResource.id] || [];
+ const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithParent.id]);
+ const accountMetadata = metadataByAccountId[accountWithParent.id] || [];
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.Read,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: accountWithResource.resource.name,
- accountName: accountWithResource.name,
- resourceType: accountWithResource.resource.resourceType,
+ accountName: accountWithParent.name,
+ ...(accountWithParent.resource && {
+ resourceName: accountWithParent.resource.name,
+ resourceType: accountWithParent.resource.resourceType
+ }),
+ ...(accountWithParent.domain && {
+ domainName: accountWithParent.domain.name,
+ domainType: accountWithParent.domain.domainType
+ }),
metadata: accountMetadata
})
);
- const decryptedAccount = await decryptAccount(accountWithResource, accountWithResource.projectId, kmsService);
+ const decryptedAccount = await decryptAccount(accountWithParent, accountWithParent.projectId, kmsService);
return {
...decryptedAccount,
+ parentType: accountWithParent.resource?.resourceType || accountWithParent.domain?.domainType || "",
metadata: accountMetadata,
- resourceType: accountWithResource.resource.resourceType,
- resource: {
- id: accountWithResource.resource.id,
- name: accountWithResource.resource.name,
- resourceType: accountWithResource.resource.resourceType,
- rotationCredentialsConfigured: !!accountWithResource.resource.encryptedRotationAccountCredentials
- }
+ resource: accountWithParent.resource
+ ? {
+ id: accountWithParent.resource.id,
+ name: accountWithParent.resource.name,
+ resourceType: accountWithParent.resource.resourceType,
+ rotationCredentialsConfigured: !!accountWithParent.resource.encryptedRotationAccountCredentials
+ }
+ : null,
+ domain: accountWithParent.domain
+ ? {
+ id: accountWithParent.domain.id,
+ name: accountWithParent.domain.name,
+ domainType: accountWithParent.domain.domainType
+ }
+ : null
};
};
@@ -745,10 +895,6 @@ export const pamAccountServiceFactory = ({
kmsService
);
- // Disable access to Active Directory
- if (resourceType === PamResource.ActiveDirectory)
- throw new BadRequestError({ message: `Active Directory resources cannot be accessed` });
-
// Temporarily disable access to Windows Server
if (resourceType === PamResource.Windows)
throw new BadRequestError({ message: `Windows resources cannot be accessed at this time` });
@@ -980,7 +1126,7 @@ export const pamAccountServiceFactory = ({
const account = await pamAccountDAL.findById(session.accountId);
if (!account) throw new NotFoundError({ message: `Account with ID '${session.accountId}' not found` });
- const resource = await pamResourceDAL.findById(account.resourceId);
+ const resource = await pamResourceDAL.findById(account.resourceId!);
if (!resource) throw new NotFoundError({ message: `Resource with ID '${account.resourceId}' not found` });
if (resource.gatewayId && resource.gatewayIdentityId !== actor.id) {
@@ -1093,13 +1239,16 @@ export const pamAccountServiceFactory = ({
if (minIntervalSeconds === Infinity) return [];
const resourceIdsWithRules = Object.keys(rulesByResource);
- const accounts = await pamAccountDAL.findRotationCandidates(resourceIdsWithRules, minIntervalSeconds);
+ const accounts = await pamAccountDAL.findRotationCandidates({
+ resourceIds: resourceIdsWithRules,
+ minIntervalSeconds
+ });
const now = Date.now();
const dueAccounts: TPamAccounts[] = [];
for (const account of accounts) {
- const rules = rulesByResource[account.resourceId];
+ const rules = rulesByResource[account.resourceId!];
// eslint-disable-next-line no-continue
if (!rules) continue;
@@ -1142,7 +1291,7 @@ export const pamAccountServiceFactory = ({
if (!claimed) return;
// Read resource
- const resource = await pamResourceDAL.findById(account.resourceId);
+ const resource = await pamResourceDAL.findById(account.resourceId!);
if (!resource || !resource.encryptedRotationAccountCredentials) {
logger.warn(
`[Rotation] Resource or rotation credentials missing for account [accountId=${account.id}], releasing lock`
@@ -1310,7 +1459,7 @@ export const pamAccountServiceFactory = ({
metadata: {
accountId: account.id,
accountName: account.name,
- resourceId: account.resourceId,
+ resourceId: account.resourceId!,
resourceType: logResourceType,
errorMessage
}
@@ -1333,60 +1482,65 @@ export const pamAccountServiceFactory = ({
};
const triggerManualRotation = async (accountId: string, actor: OrgServiceActor) => {
- const accountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
- if (!accountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const accountWithParent = await pamAccountDAL.findByIdWithParentDetails(accountId);
+ if (!accountWithParent) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ if (!accountWithParent.resource)
+ throw new NotFoundError({ message: `Resource not found for account '${accountId}'` });
const { permission } = await permissionService.getProjectPermission({
actor: actor.type,
actorAuthMethod: actor.authMethod,
actorId: actor.id,
actorOrgId: actor.orgId,
- projectId: accountWithResource.projectId,
+ projectId: accountWithParent.projectId,
actionProjectType: ActionProjectType.PAM
});
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.TriggerRotation,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: accountWithResource.resource.name,
- accountName: accountWithResource.name,
- resourceType: accountWithResource.resource.resourceType
+ resourceName: accountWithParent.resource.name,
+ accountName: accountWithParent.name,
+ resourceType: accountWithParent.resource.resourceType
})
);
- if (!accountWithResource.resource.encryptedRotationAccountCredentials) {
+ if (!accountWithParent.resource.encryptedRotationAccountCredentials) {
throw new BadRequestError({ message: "Rotation credentials are not configured on this resource" });
}
// Immediate check. There's an actual atomic lock in rotateAccount
- if (accountWithResource.rotationStatus === PamAccountRotationStatus.Rotating) {
+ if (accountWithParent.rotationStatus === PamAccountRotationStatus.Rotating) {
throw new BadRequestError({ message: "Account is already being rotated" });
}
- await rotateAccount(accountWithResource);
+ await rotateAccount(accountWithParent);
- const updatedAccountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
- if (!updatedAccountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const updatedAccountWithParent = await pamAccountDAL.findByIdWithParentDetails(accountId);
+ if (!updatedAccountWithParent) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ if (!updatedAccountWithParent.resource)
+ throw new NotFoundError({ message: `Resource not found for account '${accountId}'` });
- const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([updatedAccountWithResource.id]);
- const accountMetadata = metadataByAccountId[updatedAccountWithResource.id] || [];
+ const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([updatedAccountWithParent.id]);
+ const accountMetadata = metadataByAccountId[updatedAccountWithParent.id] || [];
const decryptedAccount = await decryptAccount(
- updatedAccountWithResource,
- updatedAccountWithResource.projectId,
+ updatedAccountWithParent,
+ updatedAccountWithParent.projectId,
kmsService
);
return {
...decryptedAccount,
metadata: accountMetadata,
- resourceType: updatedAccountWithResource.resource.resourceType,
+ parentType: updatedAccountWithParent.resource.resourceType,
resource: {
- id: updatedAccountWithResource.resource.id,
- name: updatedAccountWithResource.resource.name,
- resourceType: updatedAccountWithResource.resource.resourceType,
- rotationCredentialsConfigured: !!updatedAccountWithResource.resource.encryptedRotationAccountCredentials
- }
+ id: updatedAccountWithParent.resource.id,
+ name: updatedAccountWithParent.resource.name,
+ resourceType: updatedAccountWithParent.resource.resourceType,
+ rotationCredentialsConfigured: !!updatedAccountWithParent.resource.encryptedRotationAccountCredentials
+ },
+ domain: null
};
};
@@ -1398,46 +1552,54 @@ export const pamAccountServiceFactory = ({
actorAuthMethod,
actorOrgId
}: TViewAccountCredentialsDTO) => {
- const accountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
- if (!accountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const accountWithParent = await pamAccountDAL.findByIdWithParentDetails(accountId);
+ if (!accountWithParent) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ if (!accountWithParent.resource && !accountWithParent.domain)
+ throw new NotFoundError({ message: `Parent not found for account '${accountId}'` });
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
- projectId: accountWithResource.projectId,
+ projectId: accountWithParent.projectId,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.PAM
});
- const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithResource.id]);
- const accountMetadata = metadataByAccountId[accountWithResource.id] || [];
+ const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithParent.id]);
+ const accountMetadata = metadataByAccountId[accountWithParent.id] || [];
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionPamAccountActions.ReadCredentials,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: accountWithResource.resource.name,
- resourceType: accountWithResource.resource.resourceType,
- accountName: accountWithResource.name,
+ accountName: accountWithParent.name,
+ ...(accountWithParent.resource && {
+ resourceName: accountWithParent.resource.name,
+ resourceType: accountWithParent.resource.resourceType
+ }),
+ ...(accountWithParent.domain && {
+ domainName: accountWithParent.domain.name,
+ domainType: accountWithParent.domain.domainType
+ }),
metadata: accountMetadata
})
);
- // Decrypt early so we can check if there are sensitive fields before triggering MFA
+ const parentType = accountWithParent.resource?.resourceType || accountWithParent.domain?.domainType || "";
+
const credentials = await decryptAccountCredentials({
- encryptedCredentials: accountWithResource.encryptedCredentials,
+ encryptedCredentials: accountWithParent.encryptedCredentials,
kmsService,
- projectId: accountWithResource.projectId
+ projectId: accountWithParent.projectId
});
- if (!hasSensitiveCredentials(accountWithResource.resource.resourceType, credentials)) {
+ if (!hasSensitiveCredentials(parentType, credentials)) {
throw new BadRequestError({ message: "This account has no sensitive credentials to view" });
}
- if (!mfaSessionId && accountWithResource.requireMfa) {
- const project = await projectDAL.findById(accountWithResource.projectId);
- if (!project)
- throw new NotFoundError({ message: `Project with ID '${accountWithResource.projectId}' not found` });
+ if (!mfaSessionId && accountWithParent.requireMfa) {
+ const project = await projectDAL.findById(accountWithParent.projectId);
+ if (!project) throw new NotFoundError({ message: `Project with ID '${accountWithParent.projectId}' not found` });
const actorUser = await userDAL.findById(actorId);
if (!actorUser) throw new NotFoundError({ message: `User with ID '${actorId}' not found` });
@@ -1449,7 +1611,7 @@ export const pamAccountServiceFactory = ({
const userMfaMethod = actorUser.isMfaEnabled ? (actorUser.selectedMfaMethod as MfaMethod | null) : undefined;
const mfaMethod = (orgMfaMethod ?? userMfaMethod ?? MfaMethod.EMAIL) as MfaMethod;
- const newMfaSessionId = await mfaSessionService.createMfaSession(actorUser.id, accountWithResource.id, mfaMethod);
+ const newMfaSessionId = await mfaSessionService.createMfaSession(actorUser.id, accountWithParent.id, mfaMethod);
if (mfaMethod === MfaMethod.EMAIL && actorUser.email) {
await mfaSessionService.sendMfaCode(actorUser.id, actorUser.email);
@@ -1465,7 +1627,7 @@ export const pamAccountServiceFactory = ({
});
}
- if (mfaSessionId && accountWithResource.requireMfa) {
+ if (mfaSessionId && accountWithParent.requireMfa) {
const mfaSession = await mfaSessionService.getMfaSession(mfaSessionId);
if (!mfaSession) {
throw new BadRequestError({ message: "MFA session not found or expired" });
@@ -1475,7 +1637,7 @@ export const pamAccountServiceFactory = ({
throw new BadRequestError({ message: "MFA session does not belong to current user" });
}
- if (mfaSession.resourceId !== accountWithResource.id) {
+ if (mfaSession.resourceId !== accountWithParent.id) {
throw new BadRequestError({ message: "MFA session is for a different account" });
}
@@ -1488,12 +1650,24 @@ export const pamAccountServiceFactory = ({
return {
credentials,
- resourceType: accountWithResource.resource.resourceType,
- accountId: accountWithResource.id,
- accountName: accountWithResource.name,
- resourceId: accountWithResource.resource.id,
- resourceName: accountWithResource.resource.name,
- projectId: accountWithResource.projectId
+ parentType,
+ accountId: accountWithParent.id,
+ accountName: accountWithParent.name,
+ projectId: accountWithParent.projectId,
+ resource: accountWithParent.resource
+ ? {
+ id: accountWithParent.resource.id,
+ name: accountWithParent.resource.name,
+ resourceType: accountWithParent.resource.resourceType
+ }
+ : null,
+ domain: accountWithParent.domain
+ ? {
+ id: accountWithParent.domain.id,
+ name: accountWithParent.domain.name,
+ domainType: accountWithParent.domain.domainType
+ }
+ : null
};
};
diff --git a/backend/src/ee/services/pam-account/pam-account-types.ts b/backend/src/ee/services/pam-account/pam-account-types.ts
index 5b1d033ed7..94e82c1f83 100644
--- a/backend/src/ee/services/pam-account/pam-account-types.ts
+++ b/backend/src/ee/services/pam-account/pam-account-types.ts
@@ -9,8 +9,10 @@ import { PamAccountOrderBy, PamAccountView } from "./pam-account-enums";
// DTOs
export type TCreateAccountDTO = Pick<
TPamAccount,
- "name" | "description" | "credentials" | "folderId" | "resourceId" | "requireMfa"
+ "name" | "description" | "credentials" | "folderId" | "requireMfa"
> & {
+ resourceId?: string;
+ domainId?: string;
internalMetadata?: Record<string, unknown>;
metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
};
@@ -39,6 +41,7 @@ export type TListAccountsDTO = {
limit?: number;
offset?: number;
filterResourceIds?: string[];
+ filterDomainIds?: string[];
metadataFilter?: Array<{ key: string; value?: string }>;
} & TProjectPermission;
diff --git a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
index d25b83719b..e97d89e892 100644
--- a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
+++ b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts
@@ -20,9 +20,11 @@ import { TPamAccountDALFactory } from "../../pam-account/pam-account-dal";
import { encryptAccountCredentials } from "../../pam-account/pam-account-fns";
import {
TActiveDirectoryAccountCredentials,
- TActiveDirectoryAccountInternalMetadata,
- TActiveDirectoryResourceConnectionDetails
-} from "../../pam-resource/active-directory/active-directory-resource-types";
+ TActiveDirectoryAccountInternalMetadata
+} from "../../pam-domain/active-directory/active-directory-domain-types";
+import { TPamDomainDALFactory } from "../../pam-domain/pam-domain-dal";
+import { PamDomainType } from "../../pam-domain/pam-domain-enums";
+import { encryptDomainConnectionDetails } from "../../pam-domain/pam-domain-fns";
import { TPamResourceDALFactory } from "../../pam-resource/pam-resource-dal";
import { PamResource } from "../../pam-resource/pam-resource-enums";
import { encryptResourceConnectionDetails, encryptResourceInternalMetadata } from "../../pam-resource/pam-resource-fns";
@@ -453,32 +455,32 @@ const executeLdapEnumeration = async (
);
};
-const upsertAdServerResource = async (
+const upsertDomain = async (
projectId: string,
configuration: TAdDiscoveryConfiguration,
gatewayId: string,
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">,
- pamResourceDAL: Pick<TPamResourceDALFactory, "create" | "find">,
+ pamDomainDAL: Pick<TPamDomainDALFactory, "create" | "find">,
tx: Knex
) => {
const fingerprint = configuration.domainFQDN.toLowerCase();
- const existing = await pamResourceDAL.find(
+ const existing = await pamDomainDAL.find(
{
projectId,
- resourceType: PamResource.ActiveDirectory,
+ domainType: PamDomainType.ActiveDirectory,
discoveryFingerprint: fingerprint
},
{ tx }
);
if (existing.length > 0) {
- return { resource: existing[0], isNew: false };
+ return { domain: existing[0], isNew: false };
}
const domainResourceName = toSlugName(configuration.domainFQDN);
- const encryptedConnectionDetails = await encryptResourceConnectionDetails({
+ const encryptedConnectionDetails = await encryptDomainConnectionDetails({
projectId,
connectionDetails: {
domain: configuration.domainFQDN,
@@ -488,15 +490,15 @@ const upsertAdServerResource = async (
ldapRejectUnauthorized: configuration.ldapRejectUnauthorized,
ldapCaCert: configuration.ldapCaCert,
ldapTlsServerName: configuration.ldapTlsServerName
- } as TActiveDirectoryResourceConnectionDetails,
+ },
kmsService
});
- const resource = await pamResourceDAL.create(
+ const domain = await pamDomainDAL.create(
{
projectId,
name: domainResourceName,
- resourceType: PamResource.ActiveDirectory,
+ domainType: PamDomainType.ActiveDirectory,
gatewayId,
encryptedConnectionDetails,
discoveryFingerprint: fingerprint
@@ -504,13 +506,13 @@ const upsertAdServerResource = async (
tx
);
- return { resource, isNew: true };
+ return { domain, isNew: true };
};
const upsertWindowsServerResource = async (
projectId: string,
computer: TLdapComputer,
- adServerResourceId: string,
+ domainId: string,
gatewayId: string,
winrmConfig: {
winrmPort: number;
@@ -529,7 +531,7 @@ const upsertWindowsServerResource = async (
projectId,
resourceType: PamResource.Windows,
discoveryFingerprint: fingerprint,
- adServerResourceId
+ domainId
},
{ tx }
);
@@ -570,8 +572,7 @@ const upsertWindowsServerResource = async (
gatewayId,
encryptedConnectionDetails,
encryptedResourceMetadata,
- adServerResourceId,
- discoveryFingerprint: fingerprint
+ domainId
},
tx
);
@@ -582,7 +583,7 @@ const upsertWindowsServerResource = async (
const upsertDomainAccount = async (
projectId: string,
user: TLdapUser,
- adServerResourceId: string,
+ domainId: string,
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">,
pamAccountDAL: Pick<TPamAccountDALFactory, "create" | "find">,
tx: Knex
@@ -591,7 +592,7 @@ const upsertDomainAccount = async (
const existing = await pamAccountDAL.find(
{
- resourceId: adServerResourceId,
+ domainId,
discoveryFingerprint: fingerprint
},
{ tx }
@@ -634,7 +635,7 @@ const upsertDomainAccount = async (
const account = await pamAccountDAL.create(
{
projectId,
- resourceId: adServerResourceId,
+ domainId,
name: accountName,
encryptedCredentials,
internalMetadata,
@@ -932,6 +933,7 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<
pamDiscoverySourceAccountsDAL,
pamDiscoverySourceDependenciesDAL,
pamAccountDependenciesDAL,
+ pamDomainDAL,
pamResourceDAL,
pamAccountDAL,
kmsService
@@ -985,30 +987,11 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<
} as TActiveDirectoryDiscoverySourceRunProgress
});
- // Auto-import AD Server resource
- const { resource: adServerResource, isNew: isAdServerNew } = await pamResourceDAL.transaction(async (tx) => {
- const result = await upsertAdServerResource(
- projectId,
- configuration,
- gatewayId,
- kmsService,
- pamResourceDAL,
- tx
- );
-
- await pamDiscoverySourceResourcesDAL.upsertJunction(
- {
- discoverySourceId,
- resourceId: result.resource.id,
- lastDiscoveredRunId: run.id
- },
- tx
- );
-
+ // Auto-import AD domain
+ const { domain } = await pamDomainDAL.transaction(async (tx) => {
+ const result = await upsertDomain(projectId, configuration, gatewayId, kmsService, pamDomainDAL, tx);
return result;
});
- resourcesDiscoveredCount += 1;
- if (isAdServerNew) newResourcesCount += 1;
// Auto-import Windows Server resources and build mapping for local account discovery
const computerResourceMap = new Map<string, string>(); // objectGUID -> resourceId
@@ -1019,7 +1002,7 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<
const result = await upsertWindowsServerResource(
projectId,
computer,
- adServerResource.id,
+ domain.id,
gatewayId,
{
winrmPort: configuration.winrmPort,
@@ -1063,14 +1046,7 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<
for await (const user of users) {
try {
const { account, isNew } = await pamAccountDAL.transaction(async (tx) => {
- const result = await upsertDomainAccount(
- projectId,
- user,
- adServerResource.id,
- kmsService,
- pamAccountDAL,
- tx
- );
+ const result = await upsertDomainAccount(projectId, user, domain.id, kmsService, pamAccountDAL, tx);
await pamDiscoverySourceAccountsDAL.upsertJunction(
{
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-factory.ts b/backend/src/ee/services/pam-discovery/pam-discovery-factory.ts
index 4c6a12110e..1c39e3136e 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-factory.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-factory.ts
@@ -14,6 +14,7 @@ import {
TPamDiscoveryCredentials,
TPamDiscoveryFactory
} from "@app/ee/services/pam-discovery/pam-discovery-types";
+import { TPamDomainDALFactory } from "@app/ee/services/pam-domain/pam-domain-dal";
import { TPamResourceDALFactory } from "@app/ee/services/pam-resource/pam-resource-dal";
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
@@ -27,6 +28,7 @@ export type TPamDiscoveryScanDeps = {
"upsertJunction" | "markStaleForRun"
>;
pamAccountDependenciesDAL: Pick<TPamAccountDependenciesDALFactory, "upsertDependency">;
+ pamDomainDAL: Pick<TPamDomainDALFactory, "create" | "find" | "transaction">;
pamResourceDAL: Pick<TPamResourceDALFactory, "create" | "find" | "findById" | "updateById" | "transaction">;
pamAccountDAL: Pick<TPamAccountDALFactory, "create" | "find" | "updateById" | "transaction">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts b/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
index ae4cc4d87d..fe6979c2d6 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-queue.ts
@@ -5,6 +5,7 @@ import { JOB_SCHEDULER_PREFIX, QueueJobs, QueueName, TQueueServiceFactory } from
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { TPamAccountDALFactory } from "../pam-account/pam-account-dal";
+import { TPamDomainDALFactory } from "../pam-domain/pam-domain-dal";
import { TPamResourceDALFactory } from "../pam-resource/pam-resource-dal";
import { TPamAccountDependenciesDALFactory } from "./pam-account-dependencies-dal";
import { PamDiscoverySourceRunTrigger, PamDiscoveryType } from "./pam-discovery-enums";
@@ -27,6 +28,7 @@ type TPamDiscoveryQueueFactoryDep = {
"upsertJunction" | "markStaleForRun"
>;
pamAccountDependenciesDAL: Pick<TPamAccountDependenciesDALFactory, "upsertDependency">;
+ pamDomainDAL: Pick<TPamDomainDALFactory, "create" | "find" | "transaction">;
pamResourceDAL: Pick<TPamResourceDALFactory, "create" | "find" | "findById" | "updateById" | "transaction">;
pamAccountDAL: Pick<TPamAccountDALFactory, "create" | "find" | "updateById" | "transaction">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
@@ -44,6 +46,7 @@ export const pamDiscoveryQueueFactory = ({
pamDiscoverySourceAccountsDAL,
pamDiscoverySourceDependenciesDAL,
pamAccountDependenciesDAL,
+ pamDomainDAL,
pamResourceDAL,
pamAccountDAL,
kmsService,
@@ -92,6 +95,7 @@ export const pamDiscoveryQueueFactory = ({
pamDiscoverySourceAccountsDAL,
pamDiscoverySourceDependenciesDAL,
pamAccountDependenciesDAL,
+ pamDomainDAL,
pamResourceDAL,
pamAccountDAL,
kmsService,
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-schemas.ts b/backend/src/ee/services/pam-discovery/pam-discovery-schemas.ts
index 1d5ddbb862..ce8a9cc98c 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-schemas.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-schemas.ts
@@ -8,7 +8,8 @@ import {
} from "@app/db/schemas";
import { slugSchema } from "@app/server/lib/schemas";
-import { ActiveDirectoryAccountMetadataSchema } from "../pam-resource/active-directory/active-directory-resource-schemas";
+import { ActiveDirectoryAccountMetadataSchema } from "../pam-domain/active-directory/active-directory-domain-schemas";
+import { PamDomainType } from "../pam-domain/pam-domain-enums";
import { PamResource } from "../pam-resource/pam-resource-enums";
import { SSHResourceInternalMetadataSchema } from "../pam-resource/ssh/ssh-resource-schemas";
import {
@@ -63,9 +64,12 @@ export const DiscoveredResourceSchema = PamDiscoverySourceResourcesSchema.extend
});
export const DiscoveredAccountSchema = PamDiscoverySourceAccountsSchema.extend({
- resourceType: z.nativeEnum(PamResource),
- resourceName: z.string(),
- resourceId: z.string().uuid(),
+ resourceType: z.nativeEnum(PamResource).nullable().optional(),
+ resourceName: z.string().nullable().optional(),
+ resourceId: z.string().uuid().nullable().optional(),
+ domainType: z.nativeEnum(PamDomainType).nullable().optional(),
+ domainName: z.string().nullable().optional(),
+ domainId: z.string().uuid().nullable().optional(),
accountName: z.string(),
internalMetadata: z.union([ActiveDirectoryAccountMetadataSchema, WindowsAccountMetadataSchema]),
dependencyCount: z.number().default(0)
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-accounts-dal.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-accounts-dal.ts
index f0c9e508ca..8160e25833 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-accounts-dal.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-accounts-dal.ts
@@ -21,7 +21,8 @@ export const pamDiscoverySourceAccountsDALFactory = (db: TDbClient) => {
const dbInstance = tx || db.replicaNode();
const query = dbInstance(TableName.PamDiscoverySourceAccount)
.join(TableName.PamAccount, `${TableName.PamDiscoverySourceAccount}.accountId`, `${TableName.PamAccount}.id`)
- .join(TableName.PamResource, `${TableName.PamAccount}.resourceId`, `${TableName.PamResource}.id`)
+ .leftJoin(TableName.PamResource, `${TableName.PamAccount}.resourceId`, `${TableName.PamResource}.id`)
+ .leftJoin(TableName.PamDomain, `${TableName.PamAccount}.domainId`, `${TableName.PamDomain}.id`)
.where(`${TableName.PamDiscoverySourceAccount}.discoverySourceId`, discoverySourceId);
const countQuery = query.clone().count("*", { as: "count" }).first();
@@ -30,9 +31,12 @@ export const pamDiscoverySourceAccountsDALFactory = (db: TDbClient) => {
selectAllTableCols(TableName.PamDiscoverySourceAccount),
db.ref("name").withSchema(TableName.PamAccount).as("accountName"),
db.ref("resourceId").withSchema(TableName.PamAccount).as("resourceId"),
+ db.ref("domainId").withSchema(TableName.PamAccount).as("domainId"),
db.ref("resourceType").withSchema(TableName.PamResource).as("resourceType"),
+ db.ref("domainType").withSchema(TableName.PamDomain).as("domainType"),
db.ref("internalMetadata").withSchema(TableName.PamAccount).as("internalMetadata"),
- db.ref("name").withSchema(TableName.PamResource).as("resourceName")
+ db.ref("name").withSchema(TableName.PamResource).as("resourceName"),
+ db.ref("name").withSchema(TableName.PamDomain).as("domainName")
);
void query.orderBy(`${TableName.PamAccount}.name`, "asc");
diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
index f79b197070..ca1bbd8be5 100644
--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts
@@ -76,7 +76,7 @@ type TPamDiscoverySourceServiceFactoryDep = {
| "updateById"
| "deleteById"
>;
- pamAccountDAL: Pick<TPamAccountDALFactory, "findByIdWithResourceDetails" | "findMetadataByAccountIds">;
+ pamAccountDAL: Pick<TPamAccountDALFactory, "findByIdWithParentDetails" | "findMetadataByAccountIds">;
pamResourceDAL: Pick<TPamResourceDALFactory, "findById">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
@@ -571,7 +571,7 @@ export const pamDiscoverySourceServiceFactory = ({
);
// Add dependency counts per resource
- const resourceIds = decryptedResources.map((r) => r.resourceId).filter(Boolean);
+ const resourceIds = decryptedResources.map((r) => r.resourceId).filter(Boolean) as string[];
const depCountsByResource = resourceIds.length
? await pamAccountDependenciesDAL.countByResourceIds(resourceIds)
: {};
@@ -632,32 +632,38 @@ export const pamDiscoverySourceServiceFactory = ({
actorAuthMethod: ActorAuthMethod,
actorOrgId: string
) => {
- const accountWithResource = await pamAccountDAL.findByIdWithResourceDetails(accountId);
- if (!accountWithResource) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
+ const accountWithParent = await pamAccountDAL.findByIdWithParentDetails(accountId);
+ if (!accountWithParent) throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
const { permission } = await permissionService.getProjectPermission({
actor,
actorId,
- projectId: accountWithResource.projectId,
+ projectId: accountWithParent.projectId,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.PAM
});
- const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithResource.id]);
- const accountMetadata = metadataByAccountId[accountWithResource.id] || [];
+ const metadataByAccountId = await pamAccountDAL.findMetadataByAccountIds([accountWithParent.id]);
+ const accountMetadata = metadataByAccountId[accountWithParent.id] || [];
ForbiddenError.from(permission).throwUnlessCan(
action,
subject(ProjectPermissionSub.PamAccounts, {
- resourceName: accountWithResource.resource.name,
- accountName: accountWithResource.name,
- resourceType: accountWithResource.resource.resourceType,
+ accountName: accountWithParent.name,
+ ...(accountWithParent.resource && {
+ resourceName: accountWithParent.resource.name,
+ resourceType: accountWithParent.resource.resourceType
+ }),
+ ...(accountWithParent.domain && {
+ domainName: accountWithParent.domain.name,
+ domainType: accountWithParent.domain.domainType
+ }),
metadata: accountMetadata
})
);
- return accountWithResource;
+ return accountWithParent;
};
const decryptDependencySyncMessages = async <T extends { encryptedLastSyncMessage?: Buffer | null }>(
@@ -697,7 +703,7 @@ export const pamDiscoverySourceServiceFactory = ({
actorAuthMethod: ActorAuthMethod;
actorOrgId: string;
}) => {
- const accountWithResource = await verifyAccountPermission(
+ const accountWithParent = await verifyAccountPermission(
accountId,
ProjectPermissionPamAccountActions.Read,
actor,
@@ -706,7 +712,7 @@ export const pamDiscoverySourceServiceFactory = ({
actorOrgId
);
const deps = await pamAccountDependenciesDAL.findByAccountId(accountId);
- return decryptDependencySyncMessages(deps, accountWithResource.projectId);
+ return decryptDependencySyncMessages(deps, accountWithParent.projectId);
};
const getResourceDependencies = async ({
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-enums.ts b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-enums.ts
similarity index 100%
rename from backend/src/ee/services/pam-resource/active-directory/active-directory-resource-enums.ts
rename to backend/src/ee/services/pam-domain/active-directory/active-directory-domain-enums.ts
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-factory.ts
similarity index 90%
rename from backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts
rename to backend/src/ee/services/pam-domain/active-directory/active-directory-domain-factory.ts
index d852809a8f..2f3f8caff6 100644
--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts
+++ b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-factory.ts
@@ -7,27 +7,23 @@ import { logger } from "@app/lib/logger";
import { verifyHostInputValidity } from "../../dynamic-secret/dynamic-secret-fns";
import { TGatewayV2ServiceFactory } from "../../gateway-v2/gateway-v2-service";
-import { generatePassword } from "../../secret-rotation-v2/shared/utils";
-import { PamResource } from "../pam-resource-enums";
+import { PamResource } from "../../pam-resource/pam-resource-enums";
import {
- TPamResourceFactory,
TPamResourceFactoryRotateAccountCredentials,
TPamResourceFactoryValidateAccountCredentials,
- TPamResourceInternalMetadata,
TPostRotateContext
-} from "../pam-resource-types";
-import { syncDependenciesAfterRotation } from "../shared/dependency-sync-fns";
-import { resolveDnsTcp } from "../shared/dns-over-dc";
-import {
- TActiveDirectoryAccountCredentials,
- TActiveDirectoryResourceConnectionDetails
-} from "./active-directory-resource-types";
+} from "../../pam-resource/pam-resource-types";
+import { syncDependenciesAfterRotation } from "../../pam-resource/shared/dependency-sync-fns";
+import { resolveDnsTcp } from "../../pam-resource/shared/dns-over-dc";
+import { generatePassword } from "../../secret-rotation-v2/shared/utils";
+import { TPamDomainFactory } from "../pam-domain-types";
+import { TActiveDirectoryAccountCredentials, TActiveDirectoryConnectionDetails } from "./active-directory-domain-types";
const EXTERNAL_REQUEST_TIMEOUT = 10 * 1000;
const executeWithGateway = async <T>(
config: {
- connectionDetails: TActiveDirectoryResourceConnectionDetails;
+ connectionDetails: TActiveDirectoryConnectionDetails;
resourceType: PamResource;
gatewayId: string;
targetPortOverride?: number;
@@ -64,11 +60,11 @@ const executeWithGateway = async <T>(
);
};
-export const activeDirectoryResourceFactory: TPamResourceFactory<
- TActiveDirectoryResourceConnectionDetails,
- TActiveDirectoryAccountCredentials,
- TPamResourceInternalMetadata
-> = (resourceType, connectionDetails, gatewayId, gatewayV2Service) => {
+export const activeDirectoryDomainFactory: TPamDomainFactory<
+ TActiveDirectoryConnectionDetails,
+ TActiveDirectoryAccountCredentials
+> = (domainType, connectionDetails, gatewayId, gatewayV2Service) => {
+ const resourceType = domainType as unknown as PamResource;
const ldapProtocol = connectionDetails.useLdaps ? "ldaps" : "ldap";
const buildLdapTlsOptions = () => {
@@ -113,15 +109,18 @@ export const activeDirectoryResourceFactory: TPamResourceFactory<
if (clientError) return;
if (err) {
- // Even if anonymous bind is rejected, an LDAP error response means the server is an LDAP server
- // Only reject if it's a connection-level error (not an LDAP protocol error)
+ // Connection-level errors mean the server is unreachable
+ // Any other LDAP error (e.g. InvalidCredentialsError) means the server responded with a protocol-level rejection
if (err.name === "ConnectionError" || err.name === "TimeoutError") {
client.unbind();
reject(err);
- } else {
- logger.info("[Active Directory Resource Factory] LDAP connection validated (server responded)");
+ } else if ("lde_message" in err) {
+ logger.info("[Active Directory Domain Factory] LDAP connection validated (server responded)");
client.unbind();
resolve();
+ } else {
+ client.unbind();
+ reject(err);
}
} else {
logger.info("[Active Directory Resource Factory] LDAP anonymous bind successful");
@@ -238,7 +237,7 @@ export const activeDirectoryResourceFactory: TPamResourceFactory<
// Search for target user's DN by sAMAccountName
const searchBase = connectionDetails.domain
.split(".")
- .map((dc) => `DC=${dc}`)
+ .map((dc: string) => `DC=${dc}`)
.join(",");
client.search(
diff --git a/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-schemas.ts b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-schemas.ts
new file mode 100644
index 0000000000..8bdc1144e0
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-schemas.ts
@@ -0,0 +1,74 @@
+import { z } from "zod";
+
+import {
+ BaseCreatePamAccountSchema,
+ BasePamAccountSchema,
+ BasePamAccountSchemaWithResource,
+ BaseUpdatePamAccountSchema
+} from "../../pam-resource/pam-resource-schemas";
+import { PamDomainType } from "../pam-domain-enums";
+import { ActiveDirectoryAccountType } from "./active-directory-domain-enums";
+
+export const ActiveDirectoryConnectionDetailsSchema = z.object({
+ domain: z.string().trim().min(1).max(255),
+ dcAddress: z.string().trim().min(1).max(255),
+ port: z.coerce.number().int().min(1).max(65535),
+ useLdaps: z.boolean(),
+ ldapRejectUnauthorized: z.boolean(),
+ ldapCaCert: z
+ .string()
+ .trim()
+ .transform((val) => val || undefined)
+ .optional(),
+ ldapTlsServerName: z
+ .string()
+ .trim()
+ .transform((val) => val || undefined)
+ .optional()
+});
+
+export const ActiveDirectoryAccountCredentialsSchema = z.object({
+ username: z.string().trim().min(1).max(255),
+ password: z.string().trim().min(1).max(255)
+});
+
+export const ActiveDirectoryAccountMetadataSchema = z.object({
+ accountType: z.nativeEnum(ActiveDirectoryAccountType),
+ adGuid: z.string().optional(),
+ displayName: z.string().optional(),
+ userPrincipalName: z.string().optional(),
+ servicePrincipalName: z.string().array().optional(),
+ userAccountControl: z.number().optional(),
+ passwordLastSet: z.string().optional(),
+ lastLogon: z.string().optional()
+});
+
+export const ActiveDirectoryAccountSchema = BasePamAccountSchema.extend({
+ credentials: ActiveDirectoryAccountCredentialsSchema,
+ internalMetadata: ActiveDirectoryAccountMetadataSchema
+});
+
+export const CreateActiveDirectoryAccountSchema = BaseCreatePamAccountSchema
+ .omit({ resourceId: true })
+ .extend({
+ domainId: z.string().uuid(),
+ credentials: ActiveDirectoryAccountCredentialsSchema,
+ internalMetadata: ActiveDirectoryAccountMetadataSchema
+ });
+
+export const UpdateActiveDirectoryAccountSchema = BaseUpdatePamAccountSchema.extend({
+ credentials: ActiveDirectoryAccountCredentialsSchema.optional(),
+ internalMetadata: ActiveDirectoryAccountMetadataSchema.optional()
+});
+
+export const SanitizedActiveDirectoryAccountWithDomainSchema = BasePamAccountSchemaWithResource.extend({
+ parentType: z.literal(PamDomainType.ActiveDirectory),
+ credentials: z.object({
+ username: z.string()
+ }),
+ internalMetadata: ActiveDirectoryAccountMetadataSchema
+});
+
+export const ActiveDirectorySessionCredentialsSchema = ActiveDirectoryConnectionDetailsSchema.and(
+ ActiveDirectoryAccountCredentialsSchema
+);
diff --git a/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-types.ts b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-types.ts
new file mode 100644
index 0000000000..113bc4e95a
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/active-directory/active-directory-domain-types.ts
@@ -0,0 +1,12 @@
+import { z } from "zod";
+
+import {
+ ActiveDirectoryAccountCredentialsSchema,
+ ActiveDirectoryAccountMetadataSchema,
+ ActiveDirectoryConnectionDetailsSchema
+} from "./active-directory-domain-schemas";
+
+export type TActiveDirectoryConnectionDetails = z.infer<typeof ActiveDirectoryConnectionDetailsSchema>;
+
+export type TActiveDirectoryAccountCredentials = z.infer<typeof ActiveDirectoryAccountCredentialsSchema>;
+export type TActiveDirectoryAccountInternalMetadata = z.infer<typeof ActiveDirectoryAccountMetadataSchema>;
diff --git a/backend/src/ee/services/pam-domain/pam-domain-dal.ts b/backend/src/ee/services/pam-domain/pam-domain-dal.ts
new file mode 100644
index 0000000000..c773cad156
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-dal.ts
@@ -0,0 +1,119 @@
+import { Knex } from "knex";
+import RE2 from "re2";
+
+import { TDbClient } from "@app/db";
+import { TableName } from "@app/db/schemas";
+import { DatabaseError } from "@app/lib/errors";
+import { ormify, selectAllTableCols } from "@app/lib/knex";
+import { OrderByDirection } from "@app/lib/types";
+
+import { PamDomainOrderBy } from "./pam-domain-enums";
+
+export type TPamDomainDALFactory = ReturnType<typeof pamDomainDALFactory>;
+
+export const pamDomainDALFactory = (db: TDbClient) => {
+ const orm = ormify(db, TableName.PamDomain);
+
+ const findById = async (id: string, tx?: Knex) => {
+ try {
+ const result = await (tx || db.replicaNode())(TableName.PamDomain)
+ .leftJoin(TableName.GatewayV2, `${TableName.PamDomain}.gatewayId`, `${TableName.GatewayV2}.id`)
+ .where(`${TableName.PamDomain}.id`, id)
+ .select(selectAllTableCols(TableName.PamDomain))
+ .select(
+ db.ref("name").withSchema(TableName.GatewayV2).as("gatewayName"),
+ db.ref("identityId").withSchema(TableName.GatewayV2).as("gatewayIdentityId")
+ )
+ .first();
+
+ return result || null;
+ } catch (error) {
+ throw new DatabaseError({ error, name: "Find PAM domain by ID" });
+ }
+ };
+
+ const findByProjectId = async (
+ {
+ projectId,
+ search,
+ limit,
+ offset = 0,
+ orderBy = PamDomainOrderBy.Name,
+ orderDirection = OrderByDirection.ASC,
+ filterDomainTypes,
+ discoveryFingerprint
+ }: {
+ projectId: string;
+ search?: string;
+ limit?: number;
+ offset?: number;
+ orderBy?: PamDomainOrderBy;
+ orderDirection?: OrderByDirection;
+ filterDomainTypes?: string[];
+ discoveryFingerprint?: string;
+ },
+ tx?: Knex
+ ) => {
+ try {
+ const dbInstance = tx || db.replicaNode();
+ const query = dbInstance(TableName.PamDomain).where(`${TableName.PamDomain}.projectId`, projectId);
+
+ if (search) {
+ const escapedSearch = search
+ .replace(new RE2(/\\/g), "\\\\")
+ .replace(new RE2(/%/g), "\\%")
+ .replace(new RE2(/_/g), "\\_");
+ const pattern = `%${escapedSearch}%`;
+ void query.whereRaw(`??.?? ILIKE ? ESCAPE '\\'`, [TableName.PamDomain, "name", pattern]);
+ }
+
+ if (filterDomainTypes && filterDomainTypes.length) {
+ void query.whereIn(`${TableName.PamDomain}.domainType`, filterDomainTypes);
+ }
+
+ if (discoveryFingerprint) {
+ void query.where(`${TableName.PamDomain}.discoveryFingerprint`, discoveryFingerprint);
+ }
+
+ const countQuery = query.clone().count("*", { as: "count" }).first();
+
+ void query.select(selectAllTableCols(TableName.PamDomain));
+
+ const direction = orderDirection === OrderByDirection.ASC ? "ASC" : "DESC";
+ void query.orderByRaw(`${TableName.PamDomain}.?? COLLATE "en-x-icu" ${direction}`, [orderBy]);
+
+ if (typeof limit === "number") {
+ void query.limit(limit).offset(offset);
+ }
+
+ const [results, countResult] = await Promise.all([query, countQuery]);
+ const totalCount = Number(countResult?.count || 0);
+
+ return { domains: results, totalCount };
+ } catch (error) {
+ throw new DatabaseError({ error, name: "Find PAM domains by project" });
+ }
+ };
+
+ const findMetadataByDomainIds = async (domainIds: string[], tx?: Knex) => {
+ if (!domainIds.length) return {};
+ const rows = await (tx || db.replicaNode())(TableName.ResourceMetadata)
+ .select("id", "key", "value", "pamDomainId")
+ .whereIn("pamDomainId", domainIds);
+ const byDomainId: Record<string, Array<{ id: string; key: string; value: string }>> = {};
+ for (const row of rows) {
+ if (row.pamDomainId) {
+ if (!byDomainId[row.pamDomainId]) byDomainId[row.pamDomainId] = [];
+ byDomainId[row.pamDomainId].push({ id: row.id, key: row.key, value: row.value || "" });
+ }
+ }
+ return byDomainId;
+ };
+
+ return {
+ ...orm,
+ findById,
+ findByProjectId,
+ findMetadataByDomainIds
+ };
+};
diff --git a/backend/src/ee/services/pam-domain/pam-domain-enums.ts b/backend/src/ee/services/pam-domain/pam-domain-enums.ts
new file mode 100644
index 0000000000..03fcd18cad
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-enums.ts
@@ -0,0 +1,7 @@
+export enum PamDomainType {
+ ActiveDirectory = "active-directory"
+}
+
+export enum PamDomainOrderBy {
+ Name = "name"
+}
diff --git a/backend/src/ee/services/pam-domain/pam-domain-factory.ts b/backend/src/ee/services/pam-domain/pam-domain-factory.ts
new file mode 100644
index 0000000000..1ab6a8a2e3
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-factory.ts
@@ -0,0 +1,10 @@
+import { TPamAccountCredentials } from "../pam-resource/pam-resource-types";
+import { activeDirectoryDomainFactory } from "./active-directory/active-directory-domain-factory";
+import { PamDomainType } from "./pam-domain-enums";
+import { TPamDomainConnectionDetails, TPamDomainFactory } from "./pam-domain-types";
+
+type TPamDomainFactoryImplementation = TPamDomainFactory<TPamDomainConnectionDetails, TPamAccountCredentials>;
+
+export const PAM_DOMAIN_FACTORY_MAP: Record<PamDomainType, TPamDomainFactoryImplementation> = {
+ [PamDomainType.ActiveDirectory]: activeDirectoryDomainFactory as TPamDomainFactoryImplementation
+};
diff --git a/backend/src/ee/services/pam-domain/pam-domain-fns.ts b/backend/src/ee/services/pam-domain/pam-domain-fns.ts
new file mode 100644
index 0000000000..bd2d4b4032
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-fns.ts
@@ -0,0 +1,46 @@
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { KmsDataKey } from "@app/services/kms/kms-types";
+
+import { TPamDomainConnectionDetails } from "./pam-domain-types";
+
+export const encryptDomainConnectionDetails = async ({
+ projectId,
+ connectionDetails,
+ kmsService
+}: {
+ projectId: string;
+ connectionDetails: TPamDomainConnectionDetails;
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
+}) => {
+ const { encryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId
+ });
+
+ const { cipherTextBlob } = encryptor({
+ plainText: Buffer.from(JSON.stringify(connectionDetails))
+ });
+
+ return cipherTextBlob;
+};
+
+export const decryptDomainConnectionDetails = async ({
+ projectId,
+ encryptedConnectionDetails,
+ kmsService
+}: {
+ projectId: string;
+ encryptedConnectionDetails: Buffer;
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
+}) => {
+ const { decryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId
+ });
+
+ const decryptedPlainTextBlob = decryptor({
+ cipherTextBlob: encryptedConnectionDetails
+ });
+
+ return JSON.parse(decryptedPlainTextBlob.toString()) as TPamDomainConnectionDetails;
+};
diff --git a/backend/src/ee/services/pam-domain/pam-domain-schemas.ts b/backend/src/ee/services/pam-domain/pam-domain-schemas.ts
new file mode 100644
index 0000000000..40d9378337
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-schemas.ts
@@ -0,0 +1,55 @@
+import { z } from "zod";
+
+import { PamDomainsSchema, ResourceMetadataSchema } from "@app/db/schemas";
+import { slugSchema } from "@app/server/lib/schemas";
+import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-metadata/resource-metadata-schema";
+
+import { ActiveDirectoryConnectionDetailsSchema } from "./active-directory/active-directory-domain-schemas";
+import { PamDomainType } from "./pam-domain-enums";
+
+export const BasePamDomainSchema = PamDomainsSchema.omit({
+ encryptedConnectionDetails: true,
+ domainType: true
+}).extend({
+ metadata: ResourceMetadataSchema.pick({ id: true, key: true, value: true }).array().optional()
+});
+
+export const ActiveDirectoryDomainListItemSchema = z.object({
+ name: z.literal("Active Directory"),
+ domain: z.literal(PamDomainType.ActiveDirectory)
+});
+
+const BaseActiveDirectoryDomainSchema = BasePamDomainSchema.extend({
+ domainType: z.literal(PamDomainType.ActiveDirectory)
+});
+
+export const ActiveDirectoryDomainSchema = BaseActiveDirectoryDomainSchema.extend({
+ connectionDetails: ActiveDirectoryConnectionDetailsSchema
+});
+
+export const SanitizedActiveDirectoryDomainSchema = BaseActiveDirectoryDomainSchema.extend({
+ connectionDetails: ActiveDirectoryConnectionDetailsSchema
+});
+
+const CoreCreatePamDomainSchema = z.object({
+ projectId: z.string().uuid(),
+ name: slugSchema({ field: "name" }),
+ metadata: ResourceMetadataNonEncryptionSchema.optional()
+});
+
+export const CreateActiveDirectoryDomainSchema = CoreCreatePamDomainSchema.extend({
+ gatewayId: z.string().uuid(),
+ connectionDetails: ActiveDirectoryConnectionDetailsSchema
+});
+
+const CoreUpdatePamDomainSchema = z.object({
+ name: slugSchema({ field: "name" }).optional(),
+ metadata: ResourceMetadataNonEncryptionSchema.optional()
+});
+
+export const UpdateActiveDirectoryDomainSchema = CoreUpdatePamDomainSchema.extend({
+ gatewayId: z.string().uuid().optional(),
+ connectionDetails: ActiveDirectoryConnectionDetailsSchema.optional()
+});
+
+export const SanitizedDomainSchema = z.discriminatedUnion("domainType", [SanitizedActiveDirectoryDomainSchema]);
diff --git a/backend/src/ee/services/pam-domain/pam-domain-service.ts b/backend/src/ee/services/pam-domain/pam-domain-service.ts
new file mode 100644
index 0000000000..d01fe50ec2
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-service.ts
@@ -0,0 +1,411 @@
+import { ForbiddenError, subject } from "@casl/ability";
+
+import { ActionProjectType, TPamDomains } from "@app/db/schemas";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
+import { DatabaseErrorCode } from "@app/lib/error-codes";
+import { BadRequestError, DatabaseError, NotFoundError } from "@app/lib/errors";
+import { OrgServiceActor } from "@app/lib/types";
+
+import { decryptAccountCredentials } from "../pam-account/pam-account-fns";
+import { decryptResourceConnectionDetails } from "../pam-resource/pam-resource-fns";
+import { TPamResourceConnectionDetails } from "../pam-resource/pam-resource-types";
+import { decryptDomainConnectionDetails, encryptDomainConnectionDetails } from "./pam-domain-fns";
+import { TWindowsResource } from "../pam-resource/windows-server/windows-server-resource-types";
+import { PamDomainType } from "./pam-domain-enums";
+import { PAM_DOMAIN_FACTORY_MAP } from "./pam-domain-factory";
+import {
+ TCreateDomainDTO,
+ TListDomainsDTO,
+ TPamDomain,
+ TPamDomainServiceFactoryDep,
+ TUpdateDomainDTO
+} from "./pam-domain-types";
+
+export type TPamDomainServiceFactory = ReturnType<typeof pamDomainServiceFactory>;
+
+const decryptDomain = async (
+ domain: TPamDomains,
+ projectId: string,
+ kmsService: TPamDomainServiceFactoryDep["kmsService"]
+): Promise<TPamDomain> => {
+ const connectionDetails = await decryptDomainConnectionDetails({
+ encryptedConnectionDetails: domain.encryptedConnectionDetails,
+ projectId,
+ kmsService
+ });
+
+ return {
+ ...domain,
+ domainType: domain.domainType as PamDomainType,
+ connectionDetails
+ } as TPamDomain;
+};
+
+export const pamDomainServiceFactory = ({
+ pamDomainDAL,
+ pamResourceDAL,
+ permissionService,
+ kmsService,
+ gatewayV2Service,
+ resourceMetadataDAL
+}: TPamDomainServiceFactoryDep) => {
+ const getById = async (id: string, domainType: PamDomainType, actor: OrgServiceActor) => {
+ const domain = await pamDomainDAL.findById(id);
+ if (!domain) throw new NotFoundError({ message: `Domain with ID '${id}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor: actor.type,
+ actorAuthMethod: actor.authMethod,
+ actorId: actor.id,
+ actorOrgId: actor.orgId,
+ projectId: domain.projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ const metadataByDomainId = await pamDomainDAL.findMetadataByDomainIds([domain.id]);
+ const domainMetadata = metadataByDomainId[domain.id] || [];
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ subject(ProjectPermissionSub.PamDomains, {
+ name: domain.name,
+ domainType: domain.domainType,
+ metadata: domainMetadata
+ })
+ );
+
+ if (domain.domainType !== domainType) {
+ throw new BadRequestError({
+ message: `Domain with ID '${id}' is not of type '${domainType}'`
+ });
+ }
+
+ return {
+ ...(await decryptDomain(domain, domain.projectId, kmsService)),
+ metadata: domainMetadata
+ };
+ };
+
+ const create = async (
+ { domainType, connectionDetails, gatewayId, name, projectId, metadata }: TCreateDomainDTO,
+ actor: OrgServiceActor
+ ) => {
+ const { permission } = await permissionService.getProjectPermission({
+ actor: actor.type,
+ actorAuthMethod: actor.authMethod,
+ actorId: actor.id,
+ actorOrgId: actor.orgId,
+ projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Create,
+ subject(ProjectPermissionSub.PamDomains, {
+ name,
+ domainType,
+ metadata: (metadata || []).map(({ key, value }) => ({ key, value: value ?? "" }))
+ })
+ );
+
+ const factory = PAM_DOMAIN_FACTORY_MAP[domainType](
+ domainType,
+ connectionDetails,
+ gatewayId,
+ gatewayV2Service,
+ projectId
+ );
+
+ const validatedConnectionDetails = await factory.validateConnection();
+ const encryptedConnectionDetails = await encryptDomainConnectionDetails({
+ connectionDetails: validatedConnectionDetails,
+ projectId,
+ kmsService
+ });
+
+ try {
+ const { domain: newDomain, insertedMetadata } = await pamDomainDAL.transaction(async (tx) => {
+ const created = await pamDomainDAL.create(
+ {
+ domainType,
+ encryptedConnectionDetails,
+ gatewayId,
+ name,
+ projectId
+ },
+ tx
+ );
+ let metadataRows: Awaited<ReturnType<typeof resourceMetadataDAL.insertMany>> | undefined;
+ if (metadata && metadata.length > 0) {
+ metadataRows = await resourceMetadataDAL.insertMany(
+ metadata.map(({ key, value }) => ({
+ key,
+ value: value ?? "",
+ pamDomainId: created.id,
+ orgId: actor.orgId
+ })),
+ tx
+ );
+ }
+ return { domain: created, insertedMetadata: metadataRows };
+ });
+
+ return {
+ ...(await decryptDomain(newDomain, projectId, kmsService)),
+ metadata: insertedMetadata?.map(({ id, key, value }) => ({ id, key, value: value ?? "" })) ?? []
+ };
+ } catch (err) {
+ if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
+ throw new BadRequestError({
+ message: `Domain with name '${name}' already exists in this project`
+ });
+ }
+ throw err;
+ }
+ };
+
+ const updateById = async (
+ { domainId, connectionDetails, name, gatewayId, metadata }: TUpdateDomainDTO,
+ actor: OrgServiceActor
+ ) => {
+ const domain = await pamDomainDAL.findById(domainId);
+ if (!domain) throw new NotFoundError({ message: `Domain with ID '${domainId}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor: actor.type,
+ actorAuthMethod: actor.authMethod,
+ actorId: actor.id,
+ actorOrgId: actor.orgId,
+ projectId: domain.projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ const existingMetadata = await pamDomainDAL.findMetadataByDomainIds([domainId]);
+ const currentMetadata = existingMetadata[domainId] || [];
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Edit,
+ subject(ProjectPermissionSub.PamDomains, {
+ name: domain.name,
+ domainType: domain.domainType,
+ metadata: currentMetadata
+ })
+ );
+
+ if (metadata || name) {
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Edit,
+ subject(ProjectPermissionSub.PamDomains, {
+ name: name ?? domain.name,
+ domainType: domain.domainType,
+ metadata: metadata ? metadata.map(({ key, value }) => ({ key, value: value ?? "" })) : currentMetadata
+ })
+ );
+ }
+
+ const updateDoc: Partial<TPamDomains> = {};
+ const effectiveGatewayId = gatewayId !== undefined ? gatewayId : domain.gatewayId;
+
+ if (gatewayId !== undefined) {
+ updateDoc.gatewayId = gatewayId;
+ }
+
+ if (name !== undefined) {
+ updateDoc.name = name;
+ }
+
+ if (connectionDetails !== undefined) {
+ const factory = PAM_DOMAIN_FACTORY_MAP[domain.domainType as PamDomainType](
+ domain.domainType as PamDomainType,
+ connectionDetails,
+ effectiveGatewayId,
+ gatewayV2Service,
+ domain.projectId
+ );
+ const validatedConnectionDetails = await factory.validateConnection();
+ const encryptedConnectionDetails = await encryptDomainConnectionDetails({
+ connectionDetails: validatedConnectionDetails,
+ projectId: domain.projectId,
+ kmsService
+ });
+ updateDoc.encryptedConnectionDetails = encryptedConnectionDetails;
+ }
+
+ if (Object.keys(updateDoc).length === 0 && metadata === undefined) {
+ const existingMeta = await pamDomainDAL.findMetadataByDomainIds([domainId]);
+ return {
+ ...(await decryptDomain(domain, domain.projectId, kmsService)),
+ metadata: existingMeta[domainId] || []
+ };
+ }
+
+ try {
+ const updatedDomain = await pamDomainDAL.transaction(async (tx) => {
+ if (metadata) {
+ await resourceMetadataDAL.delete({ pamDomainId: domainId }, tx);
+ if (metadata.length > 0) {
+ await resourceMetadataDAL.insertMany(
+ metadata.map(({ key, value }) => ({
+ key,
+ value: value ?? "",
+ pamDomainId: domainId,
+ orgId: actor.orgId
+ })),
+ tx
+ );
+ }
+ }
+ if (Object.keys(updateDoc).length > 0) {
+ return pamDomainDAL.updateById(domainId, updateDoc, tx);
+ }
+ return domain;
+ });
+
+ const freshMeta = await pamDomainDAL.findMetadataByDomainIds([domainId]);
+
+ return {
+ ...(await decryptDomain(updatedDomain, domain.projectId, kmsService)),
+ metadata: freshMeta[domainId] || []
+ };
+ } catch (err) {
+ if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
+ throw new BadRequestError({
+ message: `Domain with name '${name}' already exists in this project`
+ });
+ }
+ throw err;
+ }
+ };
+
+ const deleteById = async (id: string, actor: OrgServiceActor) => {
+ const domain = await pamDomainDAL.findById(id);
+ if (!domain) throw new NotFoundError({ message: `Domain with ID '${id}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor: actor.type,
+ actorAuthMethod: actor.authMethod,
+ actorId: actor.id,
+ actorOrgId: actor.orgId,
+ projectId: domain.projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ const metadataByDomainId = await pamDomainDAL.findMetadataByDomainIds([id]);
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Delete,
+ subject(ProjectPermissionSub.PamDomains, {
+ name: domain.name,
+ domainType: domain.domainType,
+ metadata: metadataByDomainId[id] || []
+ })
+ );
+
+ try {
+ const deletedDomain = await pamDomainDAL.deleteById(id);
+ return await decryptDomain(deletedDomain, domain.projectId, kmsService);
+ } catch (err) {
+ if (
+ err instanceof DatabaseError &&
+ (err.error as { code: string })?.code === DatabaseErrorCode.ForeignKeyViolation
+ ) {
+ throw new BadRequestError({
+ message: "Failed to delete domain because it is attached to active PAM accounts or resources"
+ });
+ }
+ throw err;
+ }
+ };
+
+ const list = async ({ projectId, actor, actorId, actorAuthMethod, actorOrgId, ...params }: TListDomainsDTO) => {
+ const { permission } = await permissionService.getProjectPermission({
+ actor,
+ actorId,
+ actorAuthMethod,
+ actorOrgId,
+ projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.PamDomains);
+
+ const { domains, totalCount } = await pamDomainDAL.findByProjectId({
+ projectId,
+ ...params
+ });
+
+ const domainIds = domains.map((d) => d.id);
+ const metadataByDomainId = await pamDomainDAL.findMetadataByDomainIds(domainIds);
+
+ return {
+ domains: await Promise.all(
+ domains.map(async (d) => ({
+ ...(await decryptDomain(d, projectId, kmsService)),
+ metadata: metadataByDomainId[d.id] || []
+ }))
+ ),
+ totalCount
+ };
+ };
+
+ const listRelatedResources = async (domainId: string, actor: OrgServiceActor) => {
+ const domain = await pamDomainDAL.findById(domainId);
+ if (!domain) throw new NotFoundError({ message: `Domain with ID '${domainId}' not found` });
+
+ const { permission } = await permissionService.getProjectPermission({
+ actor: actor.type,
+ actorAuthMethod: actor.authMethod,
+ actorId: actor.id,
+ actorOrgId: actor.orgId,
+ projectId: domain.projectId,
+ actionProjectType: ActionProjectType.PAM
+ });
+
+ const metadataByDomainId = await pamDomainDAL.findMetadataByDomainIds([domainId]);
+
+ ForbiddenError.from(permission).throwUnlessCan(
+ ProjectPermissionActions.Read,
+ subject(ProjectPermissionSub.PamDomains, {
+ name: domain.name,
+ domainType: domain.domainType,
+ metadata: metadataByDomainId[domainId] || []
+ })
+ );
+
+ const relatedResources = await pamResourceDAL.find({ domainId });
+
+ return Promise.all(
+ relatedResources.map(async (r) => {
+ const rConnectionDetails = await decryptResourceConnectionDetails({
+ encryptedConnectionDetails: r.encryptedConnectionDetails,
+ projectId: domain.projectId,
+ kmsService
+ });
+ const rotationAccountCredentials = r.encryptedRotationAccountCredentials
+ ? await decryptAccountCredentials({
+ encryptedCredentials: r.encryptedRotationAccountCredentials,
+ projectId: domain.projectId,
+ kmsService
+ })
+ : null;
+ return { ...r, connectionDetails: rConnectionDetails, rotationAccountCredentials } as TWindowsResource;
+ })
+ );
+ };
+
+ const listDomainOptions = () => {
+ return [{ name: "Active Directory" as const, domain: PamDomainType.ActiveDirectory }].sort((a, b) =>
+ a.name.localeCompare(b.name)
+ );
+ };
+
+ return {
+ getById,
+ create,
+ updateById,
+ deleteById,
+ list,
+ listRelatedResources,
+ listDomainOptions
+ };
+};
diff --git a/backend/src/ee/services/pam-domain/pam-domain-types.ts b/backend/src/ee/services/pam-domain/pam-domain-types.ts
new file mode 100644
index 0000000000..827467d9c2
--- /dev/null
+++ b/backend/src/ee/services/pam-domain/pam-domain-types.ts
@@ -0,0 +1,89 @@
+import { z } from "zod";
+
+import { OrderByDirection, TProjectPermission } from "@app/lib/types";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+import { TResourceMetadataDALFactory } from "@app/services/resource-metadata/resource-metadata-dal";
+import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-metadata/resource-metadata-schema";
+
+import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
+import { TPamResourceDALFactory } from "../pam-resource/pam-resource-dal";
+import { TPostRotateContext } from "../pam-resource/pam-resource-types";
+import { TPermissionServiceFactory } from "../permission/permission-service-types";
+import { TActiveDirectoryConnectionDetails } from "./active-directory/active-directory-domain-types";
+import { TPamDomainDALFactory } from "./pam-domain-dal";
+import { PamDomainOrderBy, PamDomainType } from "./pam-domain-enums";
+
+export type TPamDomainConnectionDetails = TActiveDirectoryConnectionDetails;
+
+export type TPamDomain = {
+ id: string;
+ projectId: string;
+ name: string;
+ domainType: PamDomainType;
+ gatewayId?: string | null;
+ discoveryFingerprint?: string | null;
+ createdAt: Date;
+ updatedAt: Date;
+ connectionDetails: TPamDomainConnectionDetails;
+ metadata?: Array<{ id: string; key: string; value: string }>;
+};
+
+export type TCreateDomainDTO = {
+ projectId: string;
+ name: string;
+ domainType: PamDomainType;
+ gatewayId?: string | null;
+ connectionDetails: TPamDomainConnectionDetails;
+ metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
+};
+
+export type TUpdateDomainDTO = {
+ domainId: string;
+ name?: string;
+ gatewayId?: string | null;
+ connectionDetails?: TPamDomainConnectionDetails;
+ metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
+};
+
+export type TListDomainsDTO = {
+ search?: string;
+ orderBy?: PamDomainOrderBy;
+ orderDirection?: OrderByDirection;
+ limit?: number;
+ offset?: number;
+ discoveryFingerprint?: string;
+ filterDomainTypes?: string[];
+} & TProjectPermission;
+
+export type TDeleteDomainDTO = {
+ domainId: string;
+};
+
+export type TPamDomainServiceFactoryDep = {
+ pamDomainDAL: TPamDomainDALFactory;
+ pamResourceDAL: Pick<TPamResourceDALFactory, "find" | "findById">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;
+ resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "insertMany" | "delete">;
+};
+
+export type TPamDomainFactory<T, C> = (
+ domainType: PamDomainType,
+ connectionDetails: T,
+ gatewayId: string | null | undefined,
+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,
+ projectId: string | null | undefined
+) => {
+ validateConnection: () => Promise<T>;
+ validateAccountCredentials: (credentials: C) => Promise<C>;
+ rotateAccountCredentials: (rotationAccountCredentials: C, currentCredentials: C) => Promise<C>;
+ postRotate?: (
+ accountId: string,
+ newCredentials: C,
+ projectId: string,
+ ctx: TPostRotateContext,
+ rotationAccountCredentials: C
+ ) => Promise<void>;
+ handleOverwritePreventionForCensoredValues: (updatedAccountCredentials: C, currentCredentials: C) => Promise<C>;
+};
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-fns.ts b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-fns.ts
deleted file mode 100644
index 5b4ad8a299..0000000000
--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-fns.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { ActiveDirectoryResourceListItemSchema } from "./active-directory-resource-schemas";
-
-export const getActiveDirectoryResourceListItem = () => {
- return {
- name: ActiveDirectoryResourceListItemSchema.shape.name.value,
- resource: ActiveDirectoryResourceListItemSchema.shape.resource.value
- };
-};
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-schemas.ts b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-schemas.ts
deleted file mode 100644
index de81a0e798..0000000000
--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-schemas.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-import { z } from "zod";
-
-import { PamResource } from "../pam-resource-enums";
-import {
- BaseCreateGatewayPamResourceSchema,
- BaseCreatePamAccountSchema,
- BasePamAccountSchema,
- BasePamAccountSchemaWithResource,
- BasePamResourceSchema,
- BaseUpdateGatewayPamResourceSchema,
- BaseUpdatePamAccountSchema
-} from "../pam-resource-schemas";
-import { ActiveDirectoryAccountType } from "./active-directory-resource-enums";
-
-// Resources
-const BaseActiveDirectoryResourceSchema = BasePamResourceSchema.extend({
- resourceType: z.literal(PamResource.ActiveDirectory)
-});
-
-export const ActiveDirectoryResourceListItemSchema = z.object({
- name: z.literal("Active Directory"),
- resource: z.literal(PamResource.ActiveDirectory)
-});
-
-export const ActiveDirectoryResourceConnectionDetailsSchema = z.object({
- domain: z.string().trim().min(1).max(255),
- dcAddress: z.string().trim().min(1).max(255),
- port: z.coerce.number().int().min(1).max(65535),
- useLdaps: z.boolean(),
- ldapRejectUnauthorized: z.boolean(),
- ldapCaCert: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional(),
- ldapTlsServerName: z
- .string()
- .trim()
- .transform((val) => val || undefined)
- .optional()
-});
-
-// Credentials (username + password for AD)
-export const ActiveDirectoryAccountCredentialsSchema = z.object({
- username: z.string().trim().min(1).max(255),
- password: z.string().trim().min(1).max(255)
-});
-
-// Account metadata
-export const ActiveDirectoryAccountMetadataSchema = z.object({
- accountType: z.nativeEnum(ActiveDirectoryAccountType),
- adGuid: z.string().optional(),
- displayName: z.string().optional(),
- userPrincipalName: z.string().optional(),
- servicePrincipalName: z.string().array().optional(),
- userAccountControl: z.number().optional(),
- passwordLastSet: z.string().optional(),
- lastLogon: z.string().optional()
-});
-
-export const ActiveDirectoryResourceSchema = BaseActiveDirectoryResourceSchema.extend({
- connectionDetails: ActiveDirectoryResourceConnectionDetailsSchema,
- rotationAccountCredentials: ActiveDirectoryAccountCredentialsSchema.nullable().optional()
-});
-
-export const SanitizedActiveDirectoryResourceSchema = BaseActiveDirectoryResourceSchema.extend({
- connectionDetails: ActiveDirectoryResourceConnectionDetailsSchema,
- rotationAccountCredentials: z
- .object({
- username: z.string()
- })
- .nullable()
- .optional()
-});
-
-export const CreateActiveDirectoryResourceSchema = BaseCreateGatewayPamResourceSchema.extend({
- connectionDetails: ActiveDirectoryResourceConnectionDetailsSchema,
- rotationAccountCredentials: ActiveDirectoryAccountCredentialsSchema.nullable().optional()
-});
-
-export const UpdateActiveDirectoryResourceSchema = BaseUpdateGatewayPamResourceSchema.extend({
- connectionDetails: ActiveDirectoryResourceConnectionDetailsSchema.optional(),
- rotationAccountCredentials: ActiveDirectoryAccountCredentialsSchema.nullable().optional()
-});
-
-// Accounts
-export const ActiveDirectoryAccountSchema = BasePamAccountSchema.extend({
- credentials: ActiveDirectoryAccountCredentialsSchema,
- internalMetadata: ActiveDirectoryAccountMetadataSchema
-});
-
-export const CreateActiveDirectoryAccountSchema = BaseCreatePamAccountSchema.extend({
- credentials: ActiveDirectoryAccountCredentialsSchema,
- internalMetadata: ActiveDirectoryAccountMetadataSchema
-});
-
-export const UpdateActiveDirectoryAccountSchema = BaseUpdatePamAccountSchema.extend({
- credentials: ActiveDirectoryAccountCredentialsSchema.optional(),
- internalMetadata: ActiveDirectoryAccountMetadataSchema.optional()
-});
-
-export const SanitizedActiveDirectoryAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.ActiveDirectory),
- credentials: z.object({
- username: z.string()
- }),
- internalMetadata: ActiveDirectoryAccountMetadataSchema
-});
-
-// Sessions
-export const ActiveDirectorySessionCredentialsSchema = ActiveDirectoryResourceConnectionDetailsSchema.and(
- ActiveDirectoryAccountCredentialsSchema
-);
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts
deleted file mode 100644
index df6e1033d2..0000000000
--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { z } from "zod";
-
-import {
- ActiveDirectoryAccountCredentialsSchema,
- ActiveDirectoryAccountMetadataSchema,
- ActiveDirectoryAccountSchema,
- ActiveDirectoryResourceConnectionDetailsSchema,
- ActiveDirectoryResourceSchema
-} from "./active-directory-resource-schemas";
-
-// Resources
-export type TActiveDirectoryResource = z.infer<typeof ActiveDirectoryResourceSchema>;
-export type TActiveDirectoryResourceConnectionDetails = z.infer<typeof ActiveDirectoryResourceConnectionDetailsSchema>;
-
-// Accounts
-export type TActiveDirectoryAccount = z.infer<typeof ActiveDirectoryAccountSchema>;
-export type TActiveDirectoryAccountCredentials = z.infer<typeof ActiveDirectoryAccountCredentialsSchema>;
-export type TActiveDirectoryAccountInternalMetadata = z.infer<typeof ActiveDirectoryAccountMetadataSchema>;
diff --git a/backend/src/ee/services/pam-resource/aws-iam/aws-iam-resource-schemas.ts b/backend/src/ee/services/pam-resource/aws-iam/aws-iam-resource-schemas.ts
index cc79f17d8c..8b6f8cfc66 100644
--- a/backend/src/ee/services/pam-resource/aws-iam/aws-iam-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/aws-iam/aws-iam-resource-schemas.ts
@@ -72,7 +72,7 @@ export const UpdateAwsIamAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedAwsIamAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.AwsIam),
+ parentType: z.literal(PamResource.AwsIam),
credentials: AwsIamAccountCredentialsSchema.pick({
targetRoleArn: true,
defaultSessionDuration: true
diff --git a/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-schemas.ts b/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-schemas.ts
index aa60e91fb4..0d32cbc715 100644
--- a/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/kubernetes/kubernetes-resource-schemas.ts
@@ -81,7 +81,7 @@ export const UpdateKubernetesAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedKubernetesAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.Kubernetes),
+ parentType: z.literal(PamResource.Kubernetes),
credentials: z.discriminatedUnion("authMethod", [
z.object({
authMethod: z.literal(KubernetesAuthMethod.ServiceAccountToken)
diff --git a/backend/src/ee/services/pam-resource/mongodb/mongodb-resource-schemas.ts b/backend/src/ee/services/pam-resource/mongodb/mongodb-resource-schemas.ts
index eb2eea7b8d..dc4f3be59c 100644
--- a/backend/src/ee/services/pam-resource/mongodb/mongodb-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/mongodb/mongodb-resource-schemas.ts
@@ -117,7 +117,7 @@ export const UpdateMongoDBAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedMongoDBAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.MongoDB),
+ parentType: z.literal(PamResource.MongoDB),
credentials: MongoDBAccountCredentialsSchema.pick({
username: true
})
diff --git a/backend/src/ee/services/pam-resource/mssql/mssql-resource-schemas.ts b/backend/src/ee/services/pam-resource/mssql/mssql-resource-schemas.ts
index d865563b61..b7f15197be 100644
--- a/backend/src/ee/services/pam-resource/mssql/mssql-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/mssql/mssql-resource-schemas.ts
@@ -64,7 +64,7 @@ export const UpdateMsSQLAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedMsSQLAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.MsSQL),
+ parentType: z.literal(PamResource.MsSQL),
credentials: MsSQLAccountCredentialsSchema.pick({
username: true
})
diff --git a/backend/src/ee/services/pam-resource/mysql/mysql-resource-schemas.ts b/backend/src/ee/services/pam-resource/mysql/mysql-resource-schemas.ts
index 61a88246cd..9f6604c2cc 100644
--- a/backend/src/ee/services/pam-resource/mysql/mysql-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/mysql/mysql-resource-schemas.ts
@@ -67,7 +67,7 @@ export const UpdateMySQLAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedMySQLAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.MySQL),
+ parentType: z.literal(PamResource.MySQL),
credentials: MySQLAccountCredentialsSchema.pick({
username: true
})
diff --git a/backend/src/ee/services/pam-resource/pam-resource-dal.ts b/backend/src/ee/services/pam-resource/pam-resource-dal.ts
index 6a35aff50c..8429700c5b 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-dal.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-dal.ts
@@ -135,16 +135,16 @@ export const pamResourceDALFactory = (db: TDbClient) => {
return byResourceId;
};
- const findByAdServerResourceId = async (adServerResourceId: string, tx?: Knex) => {
+ const findByDomainId = async (domainId: string, tx?: Knex) => {
try {
const resources = await (tx || db.replicaNode())(TableName.PamResource)
.select(selectAllTableCols(TableName.PamResource))
- .where(`${TableName.PamResource}.adServerResourceId`, adServerResourceId)
+ .where(`${TableName.PamResource}.domainId`, domainId)
.orderBy(`${TableName.PamResource}.name`, "asc");
return resources;
} catch (error) {
- throw new DatabaseError({ error, name: "Find PAM resources by AD server resource ID" });
+ throw new DatabaseError({ error, name: "Find PAM resources by domain ID" });
}
};
@@ -177,7 +177,7 @@ export const pamResourceDALFactory = (db: TDbClient) => {
findById,
findByProjectId,
findMetadataByResourceIds,
- findByAdServerResourceId,
+ findByDomainId,
findByGatewayId,
countByGatewayId
};
diff --git a/backend/src/ee/services/pam-resource/pam-resource-enums.ts b/backend/src/ee/services/pam-resource/pam-resource-enums.ts
index bb7476b62e..6fdeb10fb3 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-enums.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-enums.ts
@@ -7,8 +7,7 @@ export enum PamResource {
AwsIam = "aws-iam",
Redis = "redis",
MongoDB = "mongodb",
- Windows = "windows",
- ActiveDirectory = "active-directory"
+ Windows = "windows"
}
export enum PamResourceOrderBy {
diff --git a/backend/src/ee/services/pam-resource/pam-resource-factory.ts b/backend/src/ee/services/pam-resource/pam-resource-factory.ts
index 06f9020431..6cbbbc23ac 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-factory.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-factory.ts
@@ -1,4 +1,3 @@
-import { activeDirectoryResourceFactory } from "./active-directory/active-directory-resource-factory";
import { awsIamResourceFactory } from "./aws-iam/aws-iam-resource-factory";
import { kubernetesResourceFactory } from "./kubernetes/kubernetes-resource-factory";
import { mongodbResourceFactory } from "./mongodb/mongodb-resource-factory";
@@ -29,6 +28,5 @@ export const PAM_RESOURCE_FACTORY_MAP: Record<PamResource, TPamResourceFactoryIm
[PamResource.AwsIam]: awsIamResourceFactory as TPamResourceFactoryImplementation,
[PamResource.Redis]: redisResourceFactory as TPamResourceFactoryImplementation,
[PamResource.MongoDB]: mongodbResourceFactory as TPamResourceFactoryImplementation,
- [PamResource.Windows]: windowsResourceFactory as TPamResourceFactoryImplementation,
- [PamResource.ActiveDirectory]: activeDirectoryResourceFactory as TPamResourceFactoryImplementation
+ [PamResource.Windows]: windowsResourceFactory as TPamResourceFactoryImplementation
};
diff --git a/backend/src/ee/services/pam-resource/pam-resource-fns.ts b/backend/src/ee/services/pam-resource/pam-resource-fns.ts
index 6a05f52663..c0be4813a3 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-fns.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-fns.ts
@@ -3,7 +3,6 @@ import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { KmsDataKey } from "@app/services/kms/kms-types";
import { decryptAccountCredentials } from "../pam-account/pam-account-fns";
-import { getActiveDirectoryResourceListItem } from "./active-directory/active-directory-resource-fns";
import { getAwsIamResourceListItem } from "./aws-iam/aws-iam-resource-fns";
import { getKubernetesResourceListItem } from "./kubernetes/kubernetes-resource-fns";
import { getMongoDBResourceListItem } from "./mongodb/mongodb-resource-fns";
@@ -25,7 +24,6 @@ export const listResourceOptions = () => {
getRedisResourceListItem(),
getMongoDBResourceListItem(),
getWindowsResourceListItem(),
- getActiveDirectoryResourceListItem(),
getSshResourceListItem()
].sort((a, b) => a.name.localeCompare(b.name));
};
diff --git a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
index 8e8d7e4ea0..f20e5fda62 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
@@ -1,6 +1,8 @@
import { z } from "zod";
-import { PamAccountsSchema, PamResourcesSchema, ResourceMetadataSchema } from "@app/db/schemas";
+import { PamAccountsSchema, PamDomainsSchema, PamResourcesSchema, ResourceMetadataSchema } from "@app/db/schemas";
+import { PamDomainType } from "@app/ee/services/pam-domain/pam-domain-enums";
+import { PamResource } from "@app/ee/services/pam-resource/pam-resource-enums";
import { slugSchema } from "@app/server/lib/schemas";
import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-metadata/resource-metadata-schema";
@@ -56,13 +58,18 @@ export const BasePamAccountSchema = PamAccountsSchema.omit({
});
export const BasePamAccountSchemaWithResource = BasePamAccountSchema.extend({
+ parentType: z.union([z.nativeEnum(PamResource), z.nativeEnum(PamDomainType)]),
resource: PamResourcesSchema.pick({
id: true,
name: true,
resourceType: true
- }).extend({
- rotationCredentialsConfigured: z.boolean()
- }),
+ })
+ .extend({
+ rotationCredentialsConfigured: z.boolean()
+ })
+ .nullable()
+ .optional(),
+ domain: PamDomainsSchema.pick({ id: true, name: true, domainType: true }).nullable().optional(),
lastRotationMessage: z.string().nullable().optional(),
rotationStatus: z.string().nullable().optional()
});
diff --git a/backend/src/ee/services/pam-resource/pam-resource-service.ts b/backend/src/ee/services/pam-resource/pam-resource-service.ts
index 958624ac14..f0220dde51 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-service.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-service.ts
@@ -34,12 +34,11 @@ import {
} from "./pam-resource-fns";
import { TCreateResourceDTO, TListResourcesDTO, TUpdateResourceDTO } from "./pam-resource-types";
import { TSSHResourceInternalMetadata } from "./ssh/ssh-resource-types";
-import { TWindowsResource } from "./windows-server/windows-server-resource-types";
type TPamResourceServiceFactoryDep = {
pamResourceDAL: TPamResourceDALFactory;
pamResourceFavoriteDAL: TPamResourceFavoriteDALFactory;
- pamAccountDAL: Pick<TPamAccountDALFactory, "findByProjectIdWithResourceDetails" | "findMetadataByAccountIds">;
+ pamAccountDAL: Pick<TPamAccountDALFactory, "findByProjectIdWithParentDetails" | "findMetadataByAccountIds">;
permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
gatewayV2Service: Pick<
@@ -88,7 +87,7 @@ export const pamResourceServiceFactory = ({
if (!canReadResources) {
// Check if user can read at least one account in this resource
- const { accounts } = await pamAccountDAL.findByProjectIdWithResourceDetails({
+ const { accounts } = await pamAccountDAL.findByProjectIdWithParentDetails({
projectId: resource.projectId,
accountView: PamAccountView.Flat,
filterResourceIds: [id]
@@ -141,7 +140,7 @@ export const pamResourceServiceFactory = ({
name,
projectId,
rotationAccountCredentials,
- adServerResourceId,
+ domainId,
metadata
}: TCreateResourceDTO,
actor: OrgServiceActor
@@ -179,15 +178,6 @@ export const pamResourceServiceFactory = ({
kmsService
});
- if (adServerResourceId) {
- const adResource = await pamResourceDAL.findById(adServerResourceId);
- if (!adResource)
- throw new NotFoundError({ message: `AD Server resource with ID '${adServerResourceId}' not found` });
- if (adResource.projectId !== projectId) {
- throw new BadRequestError({ message: "AD Server resource must belong to the same project" });
- }
- }
-
let encryptedRotationAccountCredentials: Buffer | null = null;
if (rotationAccountCredentials) {
@@ -210,7 +200,7 @@ export const pamResourceServiceFactory = ({
name,
projectId,
encryptedRotationAccountCredentials,
- adServerResourceId: adServerResourceId ?? null
+ domainId: domainId ?? null
},
tx
);
@@ -250,7 +240,7 @@ export const pamResourceServiceFactory = ({
name,
rotationAccountCredentials,
gatewayId,
- adServerResourceId,
+ domainId,
metadata
}: TUpdateResourceDTO,
actor: OrgServiceActor
@@ -305,16 +295,8 @@ export const pamResourceServiceFactory = ({
updateDoc.name = name;
}
- if (adServerResourceId !== undefined) {
- if (adServerResourceId) {
- const adResource = await pamResourceDAL.findById(adServerResourceId);
- if (!adResource)
- throw new NotFoundError({ message: `AD Server resource with ID '${adServerResourceId}' not found` });
- if (adResource.projectId !== resource.projectId) {
- throw new BadRequestError({ message: "AD Server resource must belong to the same project" });
- }
- }
- updateDoc.adServerResourceId = adServerResourceId;
+ if (domainId !== undefined) {
+ updateDoc.domainId = domainId;
}
if (connectionDetails !== undefined) {
@@ -566,7 +548,7 @@ export const pamResourceServiceFactory = ({
}
// Fetch all accounts for the project (flat view, no pagination) for permission checking
- const { accounts: allAccounts } = await pamAccountDAL.findByProjectIdWithResourceDetails({
+ const { accounts: allAccounts } = await pamAccountDAL.findByProjectIdWithParentDetails({
projectId,
accountView: PamAccountView.Flat
});
@@ -585,9 +567,12 @@ export const pamResourceServiceFactory = ({
Array<{ accountName: string; metadata: Array<{ id: string; key: string; value: string }> }>
>();
for (const account of allAccounts) {
- const existing = accountsByResourceId.get(account.resourceId) || [];
- existing.push({ accountName: account.name, metadata: accountMetadata[account.id] || [] });
- accountsByResourceId.set(account.resourceId, existing);
+ if (account.resourceId) {
+ // Skip domain accounts for resource-level permission check
+ const existing = accountsByResourceId.get(account.resourceId) || [];
+ existing.push({ accountName: account.name, metadata: accountMetadata[account.id] || [] });
+ accountsByResourceId.set(account.resourceId, existing);
+ }
}
// Filter to only resources where the user can read at least one account
@@ -703,41 +688,6 @@ export const pamResourceServiceFactory = ({
return { caPublicKey };
};
- const listRelatedResources = async (adServerResourceId: string, actor: OrgServiceActor) => {
- const resource = await pamResourceDAL.findById(adServerResourceId);
- if (!resource) throw new NotFoundError({ message: `Resource with ID '${adServerResourceId}' not found` });
-
- if (resource.resourceType !== PamResource.ActiveDirectory) {
- throw new BadRequestError({ message: "Related resources can only be listed for Active Directory resources" });
- }
-
- const { permission } = await permissionService.getProjectPermission({
- actor: actor.type,
- actorAuthMethod: actor.authMethod,
- actorId: actor.id,
- actorOrgId: actor.orgId,
- projectId: resource.projectId,
- actionProjectType: ActionProjectType.PAM
- });
-
- const metadataByResourceId = await pamResourceDAL.findMetadataByResourceIds([adServerResourceId]);
-
- ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionActions.Read,
- subject(ProjectPermissionSub.PamResources, {
- name: resource.name,
- resourceType: resource.resourceType,
- metadata: metadataByResourceId[adServerResourceId] || []
- })
- );
-
- const relatedResources = await pamResourceDAL.findByAdServerResourceId(adServerResourceId);
-
- return Promise.all(
- relatedResources.map((r) => decryptResource(r, resource.projectId, kmsService) as Promise<TWindowsResource>)
- );
- };
-
const setUserResourceFavorite = async ({
projectId,
resourceId,
@@ -794,7 +744,6 @@ export const pamResourceServiceFactory = ({
list,
listResourceOptions,
getOrCreateSshCa,
- listRelatedResources,
setUserResourceFavorite
};
};
diff --git a/backend/src/ee/services/pam-resource/pam-resource-types.ts b/backend/src/ee/services/pam-resource/pam-resource-types.ts
index dbb356ac72..9ce0a1a034 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-types.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-types.ts
@@ -8,12 +8,6 @@ import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-meta
import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
import { TPamAccountDependenciesDALFactory } from "../pam-discovery/pam-account-dependencies-dal";
-import {
- TActiveDirectoryAccount,
- TActiveDirectoryAccountCredentials,
- TActiveDirectoryResource,
- TActiveDirectoryResourceConnectionDetails
-} from "./active-directory/active-directory-resource-types";
import {
TAwsIamAccount,
TAwsIamAccountCredentials,
@@ -83,8 +77,7 @@ export type TPamResource =
| TKubernetesResource
| TRedisResource
| TMongoDBResource
- | TWindowsResource
- | TActiveDirectoryResource;
+ | TWindowsResource;
export type TPamResourceWithFavorite = TPamResources & { isFavorite: boolean };
export type TPamResourceConnectionDetails =
| TPostgresResourceConnectionDetails
@@ -95,8 +88,7 @@ export type TPamResourceConnectionDetails =
| TAwsIamResourceConnectionDetails
| TRedisResourceConnectionDetails
| TMongoDBResourceConnectionDetails
- | TWindowsResourceConnectionDetails
- | TActiveDirectoryResourceConnectionDetails;
+ | TWindowsResourceConnectionDetails;
export type TPamResourceInternalMetadata = TSSHResourceInternalMetadata | TWindowsResourceInternalMetadata;
// Account types
@@ -109,8 +101,7 @@ export type TPamAccount =
| TKubernetesAccount
| TRedisAccount
| TMongoDBAccount
- | TWindowsAccount
- | TActiveDirectoryAccount;
+ | TWindowsAccount;
export type TPamAccountCredentials =
| TPostgresAccountCredentials
@@ -121,14 +112,13 @@ export type TPamAccountCredentials =
| TAwsIamAccountCredentials
| TRedisAccountCredentials
| TMongoDBAccountCredentials
- | TWindowsAccountCredentials
- | TActiveDirectoryAccountCredentials;
+ | TWindowsAccountCredentials;
// Resource DTOs
export type TCreateResourceDTO = Pick<TPamResource, "name" | "connectionDetails" | "resourceType" | "projectId"> & {
gatewayId?: string | null;
rotationAccountCredentials?: TPamAccountCredentials | null;
- adServerResourceId?: string | null;
+ domainId?: string | null;
metadata?: z.input<typeof ResourceMetadataNonEncryptionSchema>;
};
diff --git a/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts b/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
index 554a414c9a..4d6e3c945c 100644
--- a/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/postgres/postgres-resource-schemas.ts
@@ -64,7 +64,7 @@ export const UpdatePostgresAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedPostgresAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.Postgres),
+ parentType: z.literal(PamResource.Postgres),
credentials: PostgresAccountCredentialsSchema.pick({
username: true
})
diff --git a/backend/src/ee/services/pam-resource/redis/redis-resource-schemas.ts b/backend/src/ee/services/pam-resource/redis/redis-resource-schemas.ts
index 99c578e730..2070498612 100644
--- a/backend/src/ee/services/pam-resource/redis/redis-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/redis/redis-resource-schemas.ts
@@ -83,7 +83,7 @@ export const UpdateRedisAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedRedisAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.Redis),
+ parentType: z.literal(PamResource.Redis),
credentials: RedisAccountCredentialsSchema.pick({
username: true
})
diff --git a/backend/src/ee/services/pam-resource/ssh/ssh-resource-schemas.ts b/backend/src/ee/services/pam-resource/ssh/ssh-resource-schemas.ts
index fa06bfb353..ea01eb3b05 100644
--- a/backend/src/ee/services/pam-resource/ssh/ssh-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/ssh/ssh-resource-schemas.ts
@@ -114,7 +114,7 @@ export const UpdateSSHAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedSSHAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.SSH),
+ parentType: z.literal(PamResource.SSH),
credentials: z.discriminatedUnion("authMethod", [
z.object({
authMethod: z.literal(SSHAuthMethod.Password),
diff --git a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts
index 29385e2f61..cdd1890edf 100644
--- a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-schemas.ts
@@ -82,13 +82,13 @@ export const SanitizedWindowsResourceSchema = BaseWindowsResourceSchema.extend({
export const CreateWindowsResourceSchema = BaseCreateGatewayPamResourceSchema.extend({
connectionDetails: WindowsResourceConnectionDetailsSchema,
rotationAccountCredentials: WindowsAccountCredentialsSchema.nullable().optional(),
- adServerResourceId: z.string().uuid().nullable().optional()
+ domainId: z.string().uuid().nullable().optional()
});
export const UpdateWindowsResourceSchema = BaseUpdateGatewayPamResourceSchema.extend({
connectionDetails: WindowsResourceConnectionDetailsSchema.optional(),
rotationAccountCredentials: WindowsAccountCredentialsSchema.nullable().optional(),
- adServerResourceId: z.string().uuid().nullable().optional()
+ domainId: z.string().uuid().nullable().optional()
});
// Accounts
@@ -108,7 +108,7 @@ export const UpdateWindowsAccountSchema = BaseUpdatePamAccountSchema.extend({
});
export const SanitizedWindowsAccountWithResourceSchema = BasePamAccountSchemaWithResource.extend({
- resourceType: z.literal(PamResource.Windows),
+ parentType: z.literal(PamResource.Windows),
credentials: z.object({
username: z.string()
}),
diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
index 8629edb994..00f3101cb7 100644
--- a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
+++ b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts
@@ -172,6 +172,10 @@ export const pamWebAccessServiceFactory = ({
throw new NotFoundError({ message: `Account with ID '${accountId}' not found` });
}
+ if (!account.resourceId) {
+ throw new BadRequestError({ message: "Web access is only available for resource-backed accounts" });
+ }
+
const resource = await pamResourceDAL.findById(account.resourceId);
if (!resource) {
@@ -420,6 +424,10 @@ export const pamWebAccessServiceFactory = ({
throw new BadRequestError({ message: "Invalid account or project" });
}
+ if (!account.resourceId) {
+ throw new BadRequestError({ message: "Web access is only available for resource-backed accounts" });
+ }
+
const resource = await pamResourceDAL.findById(account.resourceId);
if (!resource) {
throw new BadRequestError({ message: "Resource not found" });
diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.ts
index fa3d43f8a0..605958d3b6 100644
--- a/backend/src/ee/services/permission/default-roles.ts
+++ b/backend/src/ee/services/permission/default-roles.ts
@@ -63,6 +63,7 @@ const buildAdminPermissionRules = () => {
ProjectPermissionSub.SshHostGroups,
ProjectPermissionSub.PamFolders,
ProjectPermissionSub.PamResources,
+ ProjectPermissionSub.PamDomains,
ProjectPermissionSub.McpServers,
ProjectPermissionSub.McpActivityLogs
].forEach((el) => {
@@ -687,6 +688,8 @@ const buildMemberPermissionRules = () => {
can([ProjectPermissionActions.Read], ProjectPermissionSub.PamResources);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.PamDomains);
+
can(
[ProjectPermissionPamAccountActions.Access, ProjectPermissionPamAccountActions.Read],
ProjectPermissionSub.PamAccounts
@@ -769,6 +772,8 @@ const buildViewerPermissionRules = () => {
can([ProjectPermissionActions.Read], ProjectPermissionSub.PamResources);
+ can([ProjectPermissionActions.Read], ProjectPermissionSub.PamDomains);
+
can([ProjectPermissionPamAccountActions.Read], ProjectPermissionSub.PamAccounts);
can([ProjectPermissionPamDiscoveryActions.Read], ProjectPermissionSub.PamDiscovery);
diff --git a/backend/src/ee/services/permission/project-permission.ts b/backend/src/ee/services/permission/project-permission.ts
index f0e4ecf2ac..c759b612cd 100644
--- a/backend/src/ee/services/permission/project-permission.ts
+++ b/backend/src/ee/services/permission/project-permission.ts
@@ -345,6 +345,7 @@ export enum ProjectPermissionSub {
AppConnections = "app-connections",
PamFolders = "pam-folders",
PamResources = "pam-resources",
+ PamDomains = "pam-domains",
PamAccounts = "pam-accounts",
PamSessions = "pam-sessions",
PamDiscovery = "pam-discovery",
@@ -514,9 +515,11 @@ export type McpEndpointSubjectFields = {
};
export type PamAccountSubjectFields = {
- resourceName: string;
+ resourceName?: string;
+ resourceType?: string;
+ domainName?: string;
+ domainType?: string;
accountName: string;
- resourceType: string;
metadata?: { key: string; value: string }[];
};
@@ -526,6 +529,12 @@ export type PamResourceSubjectFields = {
metadata?: { key: string; value: string }[];
};
+export type PamDomainSubjectFields = {
+ name: string;
+ domainType: string;
+ metadata?: { key: string; value: string }[];
+};
+
export type ProjectPermissionSet =
| [
ProjectPermissionSecretActions,
@@ -657,6 +666,10 @@ export type ProjectPermissionSet =
ProjectPermissionActions,
ProjectPermissionSub.PamResources | (ForcedSubject<ProjectPermissionSub.PamResources> & PamResourceSubjectFields)
]
+ | [
+ ProjectPermissionActions,
+ ProjectPermissionSub.PamDomains | (ForcedSubject<ProjectPermissionSub.PamDomains> & PamDomainSubjectFields)
+ ]
| [
ProjectPermissionPamAccountActions,
ProjectPermissionSub.PamAccounts | (ForcedSubject<ProjectPermissionSub.PamAccounts> & PamAccountSubjectFields)
@@ -1247,6 +1260,28 @@ const PamAccountConditionSchema = z
})
.partial()
]),
+ domainName: z.union([
+ z.string(),
+ z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN],
+ [PermissionConditionOperators.$GLOB]: PermissionConditionSchema[PermissionConditionOperators.$GLOB]
+ })
+ .partial()
+ ]),
+ domainType: z.union([
+ z.string(),
+ z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN],
+ [PermissionConditionOperators.$GLOB]: PermissionConditionSchema[PermissionConditionOperators.$GLOB]
+ })
+ .partial()
+ ]),
metadata: z.object({
[PermissionConditionOperators.$ELEMENTMATCH]: z
.object({
@@ -1317,6 +1352,53 @@ const PamResourceConditionSchema = z
})
.partial();
+const PamDomainConditionSchema = z
+ .object({
+ name: z.union([
+ z.string(),
+ z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN],
+ [PermissionConditionOperators.$GLOB]: PermissionConditionSchema[PermissionConditionOperators.$GLOB]
+ })
+ .partial()
+ ]),
+ domainType: z.union([
+ z.string(),
+ z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN],
+ [PermissionConditionOperators.$GLOB]: PermissionConditionSchema[PermissionConditionOperators.$GLOB]
+ })
+ .partial()
+ ]),
+ metadata: z.object({
+ [PermissionConditionOperators.$ELEMENTMATCH]: z
+ .object({
+ key: z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN]
+ })
+ .partial(),
+ value: z
+ .object({
+ [PermissionConditionOperators.$EQ]: PermissionConditionSchema[PermissionConditionOperators.$EQ],
+ [PermissionConditionOperators.$NEQ]: PermissionConditionSchema[PermissionConditionOperators.$NEQ],
+ [PermissionConditionOperators.$IN]: PermissionConditionSchema[PermissionConditionOperators.$IN]
+ })
+ .partial()
+ })
+ .partial()
+ })
+ })
+ .partial();
+
const CertificateAuthorityConditionSchema = z
.object({
name: z.union([
@@ -1650,6 +1732,16 @@ const GeneralPermissionSchema = [
"When specified, only matching conditions will be allowed to access given resource."
).optional()
}),
+ z.object({
+ subject: z.literal(ProjectPermissionSub.PamDomains).describe("The entity this permission pertains to."),
+ inverted: z.boolean().optional().describe("Whether rule allows or forbids."),
+ action: CASL_ACTION_SCHEMA_NATIVE_ENUM(ProjectPermissionActions).describe(
+ "Describe what action an entity can take."
+ ),
+ conditions: PamDomainConditionSchema.describe(
+ "When specified, only matching conditions will be allowed to access given domain."
+ ).optional()
+ }),
z.object({
subject: z.literal(ProjectPermissionSub.PamAccounts).describe("The entity this permission pertains to."),
inverted: z.boolean().optional().describe("Whether rule allows or forbids."),
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index aca5ed3e16..52364a662f 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -92,6 +92,8 @@ import { pamDiscoverySourceDependenciesDALFactory } from "@app/ee/services/pam-d
import { pamDiscoverySourceResourcesDALFactory } from "@app/ee/services/pam-discovery/pam-discovery-source-resources-dal";
import { pamDiscoveryRunDALFactory } from "@app/ee/services/pam-discovery/pam-discovery-source-run-dal";
import { pamDiscoverySourceServiceFactory } from "@app/ee/services/pam-discovery/pam-discovery-source-service";
+import { pamDomainDALFactory } from "@app/ee/services/pam-domain/pam-domain-dal";
+import { pamDomainServiceFactory } from "@app/ee/services/pam-domain/pam-domain-service";
import { pamFolderDALFactory } from "@app/ee/services/pam-folder/pam-folder-dal";
import { pamFolderServiceFactory } from "@app/ee/services/pam-folder/pam-folder-service";
import { pamResourceDALFactory } from "@app/ee/services/pam-resource/pam-resource-dal";
@@ -2784,6 +2786,7 @@ export const registerRoutes = async (
});
const pamFolderDAL = pamFolderDALFactory(db);
+ const pamDomainDAL = pamDomainDALFactory(db);
const pamResourceFavoriteDAL = pamResourceFavoriteDALFactory(db);
const pamAccountDAL = pamAccountDALFactory(db);
const pamSessionDAL = pamSessionDALFactory(db);
@@ -2816,6 +2819,15 @@ export const registerRoutes = async (
resourceMetadataDAL
});
+ const pamDomainService = pamDomainServiceFactory({
+ pamDomainDAL,
+ pamResourceDAL,
+ permissionService,
+ kmsService,
+ gatewayV2Service,
+ resourceMetadataDAL
+ });
+
const pamResourceRotationRulesService = pamResourceRotationRulesServiceFactory({
pamResourceRotationRulesDAL,
pamResourceDAL,
@@ -2836,6 +2848,7 @@ export const registerRoutes = async (
const pamAccountService = pamAccountServiceFactory({
pamAccountDAL,
+ pamDomainDAL,
pamResourceRotationRulesDAL,
gatewayV2Service,
kmsService,
@@ -2895,6 +2908,7 @@ export const registerRoutes = async (
pamDiscoverySourceAccountsDAL,
pamDiscoverySourceDependenciesDAL,
pamAccountDependenciesDAL,
+ pamDomainDAL,
pamResourceDAL,
pamAccountDAL,
kmsService,
@@ -3149,6 +3163,7 @@ export const registerRoutes = async (
notification: notificationService,
pamFolder: pamFolderService,
pamResource: pamResourceService,
+ pamDomain: pamDomainService,
pamResourceRotationRules: pamResourceRotationRulesService,
pamAccount: pamAccountService,
pamSession: pamSessionService,
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 9a72395185..5ddc175a37 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -12,6 +12,7 @@ import {
UnknownUserActor,
UserActor
} from "@app/ee/services/audit-log/audit-log-types";
+import { PamParentType } from "@app/ee/services/pam-account/pam-account-enums";
import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";
import { EnforcementLevel, SecretSharingAccessType } from "@app/lib/types";
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
@@ -737,7 +738,7 @@ export type TPamResourceEvent = {
export type TPamAccountEvent = {
event: PostHogEventTypes.PamAccountCreated | PostHogEventTypes.PamAccountDeleted;
properties: {
- resourceType: string;
+ parentType: PamParentType;
projectId: string;
};
};
@@ -754,7 +755,7 @@ export type TPamAccountAccessedEvent = {
export type TPamAccountRotatedEvent = {
event: PostHogEventTypes.PamAccountRotated;
properties: {
- resourceType: string;
+ parentType: PamParentType;
projectId: string;
};
};
diff --git a/frontend/src/context/ProjectPermissionContext/types.ts b/frontend/src/context/ProjectPermissionContext/types.ts
index d1125848a7..8711e8637b 100644
--- a/frontend/src/context/ProjectPermissionContext/types.ts
+++ b/frontend/src/context/ProjectPermissionContext/types.ts
@@ -426,6 +426,7 @@ export enum ProjectPermissionSub {
AppConnections = "app-connections",
PamFolders = "pam-folders",
PamResources = "pam-resources",
+ PamDomains = "pam-domains",
PamAccounts = "pam-accounts",
PamSessions = "pam-sessions",
PamDiscovery = "pam-discovery",
@@ -517,8 +518,10 @@ export type CertificatePolicySubjectFields = {
};
export type PamAccountSubjectFields = {
- resourceName: string;
- resourceType: string;
+ resourceName?: string;
+ resourceType?: string;
+ domainName?: string;
+ domainType?: string;
accountName: string;
metadata?: { key: string; value: string }[];
};
@@ -706,6 +709,7 @@ export type ProjectPermissionSet =
| (ForcedSubject<ProjectPermissionSub.PamResources> & PamResourceSubjectFields)
)
]
+ | [ProjectPermissionActions, ProjectPermissionSub.PamDomains]
| [
ProjectPermissionPamAccountActions,
(
diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.ts
index d8f4e18d00..7a00c644a6 100644
--- a/frontend/src/hooks/api/pam/enums.ts
+++ b/frontend/src/hooks/api/pam/enums.ts
@@ -2,7 +2,6 @@
export enum PamResourceType {
Postgres = "postgres",
MySQL = "mysql",
- RDP = "rdp",
SSH = "ssh",
Kubernetes = "kubernetes",
OracleDB = "oracledb",
@@ -18,8 +17,7 @@ export enum PamResourceType {
Snowflake = "snowflake",
DynamoDB = "dynamodb",
AwsIam = "aws-iam",
- Windows = "windows",
- ActiveDirectory = "active-directory"
+ Windows = "windows"
}
export enum PamResourceOrderBy {
diff --git a/frontend/src/hooks/api/pam/maps.ts b/frontend/src/hooks/api/pam/maps.ts
index 5cba0f893e..1f1148164b 100644
--- a/frontend/src/hooks/api/pam/maps.ts
+++ b/frontend/src/hooks/api/pam/maps.ts
@@ -6,7 +6,6 @@ export const PAM_RESOURCE_TYPE_MAP: Record<
> = {
[PamResourceType.Postgres]: { name: "PostgreSQL", image: "Postgres.png" },
[PamResourceType.MySQL]: { name: "MySQL", image: "MySql.png" },
- [PamResourceType.RDP]: { name: "RDP", image: "RDP.png" },
[PamResourceType.SSH]: { name: "SSH", image: "SSH.png" },
[PamResourceType.Kubernetes]: { name: "Kubernetes", image: "Kubernetes.png" },
[PamResourceType.OracleDB]: { name: "OracleDB", image: "Oracle.png", size: 55 },
@@ -22,6 +21,5 @@ export const PAM_RESOURCE_TYPE_MAP: Record<
[PamResourceType.Snowflake]: { name: "Snowflake", image: "Snowflake.png" },
[PamResourceType.DynamoDB]: { name: "DynamoDB", image: "DynamoDB.png", size: 55 },
[PamResourceType.AwsIam]: { name: "AWS IAM", image: "Amazon Web Services.png" },
- [PamResourceType.Windows]: { name: "Windows Server", image: "Windows.png" },
- [PamResourceType.ActiveDirectory]: { name: "Active Directory", image: "ActiveDirectory.png" }
+ [PamResourceType.Windows]: { name: "Windows Server", image: "Windows.png" }
};
diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsx
index 31fb9f424a..4a346142d6 100644
--- a/frontend/src/hooks/api/pam/mutations.tsx
+++ b/frontend/src/hooks/api/pam/mutations.tsx
@@ -133,9 +133,9 @@ export const useSetPamResourceFavorite = () => {
export const useCreatePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: async ({ resourceType, ...params }: TCreatePamAccountDTO) => {
+ mutationFn: async ({ parentType, ...params }: TCreatePamAccountDTO) => {
const { data } = await apiRequest.post<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${resourceType}`,
+ `/api/v1/pam/accounts/${parentType}`,
params
);
@@ -150,9 +150,9 @@ export const useCreatePamAccount = () => {
export const useUpdatePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: async ({ resourceType, accountId, ...params }: TUpdatePamAccountDTO) => {
+ mutationFn: async ({ parentType, accountId, ...params }: TUpdatePamAccountDTO) => {
const { data } = await apiRequest.patch<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${resourceType}/${accountId}`,
+ `/api/v1/pam/accounts/${parentType}/${accountId}`,
params
);
@@ -168,9 +168,9 @@ export const useUpdatePamAccount = () => {
export const useDeletePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: async ({ resourceType, accountId }: TDeletePamAccountDTO) => {
+ mutationFn: async ({ parentType, accountId }: TDeletePamAccountDTO) => {
const { data } = await apiRequest.delete<{ account: TPamAccount }>(
- `/api/v1/pam/accounts/${resourceType}/${accountId}`
+ `/api/v1/pam/accounts/${parentType}/${accountId}`
);
return data.account;
diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsx
index db79ce84fb..57d1c9d6f9 100644
--- a/frontend/src/hooks/api/pam/queries.tsx
+++ b/frontend/src/hooks/api/pam/queries.tsx
@@ -141,32 +141,6 @@ export const useGetPamResourceById = (
});
};
-export const useListRelatedResources = (
- resourceId?: string,
- options?: Omit<
- UseQueryOptions<
- TPamResource[],
- unknown,
- TPamResource[],
- ReturnType<typeof pamKeys.listRelatedResources>
- >,
- "queryKey" | "queryFn"
- >
-) => {
- return useQuery({
- queryKey: pamKeys.listRelatedResources(resourceId || ""),
- queryFn: async () => {
- const { data } = await apiRequest.get<{ resources: TPamResource[] }>(
- `/api/v1/pam/resources/active-directory/${resourceId}/related-resources`
- );
-
- return data.resources;
- },
- enabled: !!resourceId && (options?.enabled ?? true),
- ...options
- });
-};
-
export const useGetPamResourceDependencies = (
resourceType?: PamResourceType,
resourceId?: string
@@ -204,13 +178,17 @@ export const useListPamAccounts = (
return useQuery({
queryKey: pamKeys.listAccounts(params),
queryFn: async () => {
- const { metadataFilter, filterResourceIds, ...rest } = params;
+ const { metadataFilter, filterResourceIds, filterDomainIds, ...rest } = params;
const { data } = await apiRequest.post<TListPamAccountsResponse>(
"/api/v1/pam/accounts/search",
{
...rest,
metadata: metadataFilter,
filterResourceIds: filterResourceIds
+ ?.split(",")
+ .map((s) => s.trim())
+ .filter(Boolean),
+ filterDomainIds: filterDomainIds
?.split(",")
.map((s) => s.trim())
.filter(Boolean)
diff --git a/frontend/src/hooks/api/pam/types/base-account.ts b/frontend/src/hooks/api/pam/types/base-account.ts
index eb8178e05c..a758db3350 100644
--- a/frontend/src/hooks/api/pam/types/base-account.ts
+++ b/frontend/src/hooks/api/pam/types/base-account.ts
@@ -3,14 +3,21 @@ import { PamResourceType } from "../enums";
export interface TBasePamAccount {
id: string;
projectId: string;
+ parentType: string;
folderId?: string | null;
- resourceId: string;
- resource: {
+ resourceId?: string | null;
+ domainId?: string | null;
+ resource?: {
id: string;
name: string;
resourceType: PamResourceType;
rotationCredentialsConfigured: boolean;
- };
+ } | null;
+ domain?: {
+ id: string;
+ name: string;
+ domainType: string;
+ } | null;
name: string;
description?: string | null;
credentialsConfigured: boolean;
diff --git a/frontend/src/hooks/api/pam/types/base-resource.ts b/frontend/src/hooks/api/pam/types/base-resource.ts
index 9c4f664dc5..fe3c784e08 100644
--- a/frontend/src/hooks/api/pam/types/base-resource.ts
+++ b/frontend/src/hooks/api/pam/types/base-resource.ts
@@ -3,7 +3,7 @@ export interface TBasePamResource {
projectId: string;
name: string;
gatewayId: string;
- adServerResourceId?: string | null;
+ domainId?: string | null;
metadata?: { key: string; value: string }[];
isFavorite?: boolean;
createdAt: string;
diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.ts
index 3e49bb535c..a38c207245 100644
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@ -7,7 +7,6 @@ import {
PamSessionStatus,
TerminalChannelType
} from "../enums";
-import { TActiveDirectoryAccount, TActiveDirectoryResource } from "./active-directory-resource";
import { TAwsIamAccount, TAwsIamResource } from "./aws-iam-resource";
import { TKubernetesAccount, TKubernetesResource } from "./kubernetes-resource";
import { TMongoDBAccount, TMongoDBResource } from "./mongodb-resource";
@@ -18,7 +17,6 @@ import { TRedisAccount, TRedisResource } from "./redis-resource";
import { TSSHAccount, TSSHResource } from "./ssh-resource";
import { TWindowsAccount, TWindowsResource } from "./windows-server-resource";
-export * from "./active-directory-resource";
export * from "./aws-iam-resource";
export * from "./kubernetes-resource";
export * from "./mongodb-resource";
@@ -38,8 +36,7 @@ export type TPamResource =
| TSSHResource
| TAwsIamResource
| TKubernetesResource
- | TWindowsResource
- | TActiveDirectoryResource;
+ | TWindowsResource;
export type TPamAccount =
| TPostgresAccount
@@ -50,8 +47,7 @@ export type TPamAccount =
| TSSHAccount
| TAwsIamAccount
| TKubernetesAccount
- | TWindowsAccount
- | TActiveDirectoryAccount;
+ | TWindowsAccount;
export type TPamFolder = {
id: string;
@@ -139,7 +135,7 @@ export type TCreatePamResourceDTO = Pick<
TPamResource,
"name" | "connectionDetails" | "resourceType" | "gatewayId" | "projectId"
> & {
- adServerResourceId?: string | null;
+ domainId?: string | null;
metadata?: { key: string; value: string }[];
};
@@ -148,7 +144,7 @@ export type TUpdatePamResourceDTO = Partial<
> & {
resourceId: string;
resourceType: PamResourceType;
- adServerResourceId?: string | null;
+ domainId?: string | null;
metadata?: { key: string; value: string }[];
rotationAccountCredentials?: { username: string; password: string } | null;
};
@@ -168,6 +164,7 @@ export type TListPamAccountsDTO = {
orderDirection?: OrderByDirection;
search?: string;
filterResourceIds?: string;
+ filterDomainIds?: string;
metadataFilter?: Array<{ key: string; value?: string }>;
};
@@ -175,7 +172,8 @@ export type TCreatePamAccountDTO = Pick<
TPamAccount,
"name" | "description" | "credentials" | "projectId" | "resourceId" | "folderId" | "requireMfa"
> & {
- resourceType: PamResourceType;
+ parentType: string;
+ domainId?: string;
internalMetadata?: Record<string, unknown>;
metadata?: { key: string; value: string }[];
};
@@ -184,14 +182,14 @@ export type TUpdatePamAccountDTO = Partial<
Pick<TPamAccount, "name" | "description" | "credentials" | "requireMfa">
> & {
accountId: string;
- resourceType: PamResourceType;
+ parentType: string;
internalMetadata?: Record<string, unknown>;
metadata?: { key: string; value: string }[];
};
export type TDeletePamAccountDTO = {
accountId: string;
- resourceType: PamResourceType;
+ parentType: string;
};
// Folder DTOs
diff --git a/frontend/src/hooks/api/pam/types/active-directory-resource.ts b/frontend/src/hooks/api/pamDomain/active-directory-types.ts
similarity index 59%
rename from frontend/src/hooks/api/pam/types/active-directory-resource.ts
rename to frontend/src/hooks/api/pamDomain/active-directory-types.ts
index 9e627f8bc0..5a8a26c90a 100644
--- a/frontend/src/hooks/api/pam/types/active-directory-resource.ts
+++ b/frontend/src/hooks/api/pamDomain/active-directory-types.ts
@@ -1,7 +1,3 @@
-import { PamResourceType } from "../enums";
-import { TBasePamAccount } from "./base-account";
-import { TBasePamResource } from "./base-resource";
-
export enum ActiveDirectoryAccountType {
User = "user",
Service = "service"
@@ -30,16 +26,17 @@ export type TActiveDirectoryAccountInternalMetadata = {
lastLogon?: string;
};
-// Resources
-export type TActiveDirectoryResource = TBasePamResource & {
- resourceType: PamResourceType.ActiveDirectory;
-} & {
- connectionDetails: TActiveDirectoryConnectionDetails;
- rotationAccountCredentials?: TActiveDirectoryCredentials | null;
-};
-
-// Accounts
-export type TActiveDirectoryAccount = TBasePamAccount & {
+export type TActiveDirectoryAccount = {
+ id: string;
+ name: string;
+ description?: string | null;
+ projectId: string;
+ resourceId?: string | null;
+ domainId?: string | null;
+ folderId?: string | null;
+ requireMfa: boolean;
+ createdAt: string;
+ updatedAt: string;
credentials: TActiveDirectoryCredentials;
internalMetadata: TActiveDirectoryAccountInternalMetadata;
};
diff --git a/frontend/src/hooks/api/pamDomain/enums.ts b/frontend/src/hooks/api/pamDomain/enums.ts
new file mode 100644
index 0000000000..03fcd18cad
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/enums.ts
@@ -0,0 +1,7 @@
+export enum PamDomainType {
+ ActiveDirectory = "active-directory"
+}
+
+export enum PamDomainOrderBy {
+ Name = "name"
+}
diff --git a/frontend/src/hooks/api/pamDomain/index.ts b/frontend/src/hooks/api/pamDomain/index.ts
new file mode 100644
index 0000000000..01197819d0
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/index.ts
@@ -0,0 +1,6 @@
+export * from "./active-directory-types";
+export * from "./enums";
+export * from "./maps";
+export * from "./mutations";
+export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/pamDomain/maps.ts b/frontend/src/hooks/api/pamDomain/maps.ts
new file mode 100644
index 0000000000..b64baec606
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/maps.ts
@@ -0,0 +1,8 @@
+import { PamDomainType } from "./enums";
+
+export const PAM_DOMAIN_TYPE_MAP: Record<PamDomainType, { name: string; image: string }> = {
+ [PamDomainType.ActiveDirectory]: {
+ name: "Active Directory",
+ image: "ActiveDirectory.png"
+ }
+};
diff --git a/frontend/src/hooks/api/pamDomain/mutations.tsx b/frontend/src/hooks/api/pamDomain/mutations.tsx
new file mode 100644
index 0000000000..ad55891fb2
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/mutations.tsx
@@ -0,0 +1,53 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { pamDomainKeys } from "./queries";
+import { TCreatePamDomainDTO, TDeletePamDomainDTO, TPamDomain, TUpdatePamDomainDTO } from "./types";
+
+export const useCreatePamDomain = () => {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({ domainType, ...body }: TCreatePamDomainDTO) => {
+ const { data } = await apiRequest.post<{ domain: TPamDomain }>(
+ `/api/v1/pam/domains/${domainType}`,
+ body
+ );
+ return data.domain;
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
+ }
+ });
+};
+
+export const useUpdatePamDomain = () => {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({ domainType, domainId, ...body }: TUpdatePamDomainDTO) => {
+ const { data } = await apiRequest.patch<{ domain: TPamDomain }>(
+ `/api/v1/pam/domains/${domainType}/${domainId}`,
+ body
+ );
+ return data.domain;
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
+ }
+ });
+};
+
+export const useDeletePamDomain = () => {
+ const queryClient = useQueryClient();
+ return useMutation({
+ mutationFn: async ({ domainType, domainId }: TDeletePamDomainDTO) => {
+ const { data } = await apiRequest.delete<{ domain: TPamDomain }>(
+ `/api/v1/pam/domains/${domainType}/${domainId}`
+ );
+ return data.domain;
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: pamDomainKeys.domain() });
+ }
+ });
+};
diff --git a/frontend/src/hooks/api/pamDomain/queries.tsx b/frontend/src/hooks/api/pamDomain/queries.tsx
new file mode 100644
index 0000000000..5e71ad4f20
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/queries.tsx
@@ -0,0 +1,88 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { PamDomainType } from "./enums";
+import { TListPamDomainsDTO, TPamDomain, TPamDomainRelatedResource } from "./types";
+
+export const pamDomainKeys = {
+ all: ["pam-domain"] as const,
+ domain: () => [...pamDomainKeys.all, "domain"] as const,
+ listDomainOptions: () => [...pamDomainKeys.domain(), "options"] as const,
+ listDomains: ({ projectId, ...params }: TListPamDomainsDTO) => [
+ ...pamDomainKeys.domain(),
+ "list",
+ projectId,
+ params
+ ],
+ getDomain: (domainType: string, domainId: string) => [
+ ...pamDomainKeys.domain(),
+ "get",
+ domainType,
+ domainId
+ ],
+ listRelatedResources: (domainId: string) => [...pamDomainKeys.domain(), "related", domainId]
+};
+
+export const useListPamDomainOptions = () => {
+ return useQuery({
+ queryKey: pamDomainKeys.listDomainOptions(),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{
+ options: Array<{ name: string; domain: string }>;
+ }>("/api/v1/pam/domains/options");
+
+ return data.options;
+ }
+ });
+};
+
+export const useListPamDomains = (params: TListPamDomainsDTO) => {
+ return useQuery({
+ queryKey: pamDomainKeys.listDomains(params),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{
+ domains: TPamDomain[];
+ totalCount: number;
+ }>("/api/v1/pam/domains", { params });
+ return data;
+ },
+ enabled: !!params.projectId
+ });
+};
+
+export const useGetPamDomainById = (
+ domainType: PamDomainType | string,
+ domainId: string | undefined,
+ options?: Omit<UseQueryOptions<TPamDomain>, "queryKey" | "queryFn">
+) => {
+ return useQuery({
+ queryKey: pamDomainKeys.getDomain(domainType, domainId || ""),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ domain: TPamDomain }>(
+ `/api/v1/pam/domains/${domainType}/${domainId}`
+ );
+ return data.domain;
+ },
+ enabled: !!domainId && !!domainType,
+ ...options
+ });
+};
+
+export const useListDomainRelatedResources = (
+ domainType: PamDomainType | string,
+ domainId: string | undefined,
+ options?: Omit<UseQueryOptions<TPamDomainRelatedResource[]>, "queryKey" | "queryFn">
+) => {
+ return useQuery({
+ queryKey: pamDomainKeys.listRelatedResources(domainId || ""),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ resources: TPamDomainRelatedResource[] }>(
+ `/api/v1/pam/domains/${domainType}/${domainId}/related-resources`
+ );
+ return data.resources;
+ },
+ enabled: !!domainId && !!domainType,
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/pamDomain/types.ts b/frontend/src/hooks/api/pamDomain/types.ts
new file mode 100644
index 0000000000..ac71807187
--- /dev/null
+++ b/frontend/src/hooks/api/pamDomain/types.ts
@@ -0,0 +1,61 @@
+import { TActiveDirectoryConnectionDetails } from "./active-directory-types";
+import { PamDomainType } from "./enums";
+
+export type TBasePamDomain = {
+ id: string;
+ projectId: string;
+ name: string;
+ domainType: PamDomainType;
+ gatewayId?: string | null;
+ createdAt: string;
+ updatedAt: string;
+ metadata?: Array<{ id: string; key: string; value: string }>;
+};
+
+export type TActiveDirectoryDomain = TBasePamDomain & {
+ domainType: PamDomainType.ActiveDirectory;
+ connectionDetails: TActiveDirectoryConnectionDetails;
+};
+
+export type TPamDomain = TActiveDirectoryDomain;
+
+export type TListPamDomainsDTO = {
+ projectId: string;
+ search?: string;
+ limit?: number;
+ offset?: number;
+ orderBy?: string;
+ orderDirection?: "asc" | "desc";
+ filterDomainTypes?: string;
+ discoveryFingerprint?: string;
+};
+
+export type TCreatePamDomainDTO = {
+ domainType: PamDomainType;
+ projectId: string;
+ name: string;
+ gatewayId: string;
+ connectionDetails: TActiveDirectoryConnectionDetails;
+ metadata?: Array<{ key: string; value?: string }>;
+};
+
+export type TUpdatePamDomainDTO = {
+ domainType: PamDomainType;
+ domainId: string;
+ name?: string;
+ gatewayId?: string;
+ connectionDetails?: TActiveDirectoryConnectionDetails;
+ metadata?: Array<{ key: string; value?: string }>;
+};
+
+export type TDeletePamDomainDTO = {
+ domainType: PamDomainType;
+ domainId: string;
+};
+
+export type TPamDomainRelatedResource = {
+ id: string;
+ name: string;
+ resourceType: string;
+ projectId: string;
+};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
index e3d07304dc..1019d2b5bb 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/PamNav.tsx
@@ -1,4 +1,13 @@
-import { BookCheck, Database, FileText, Search, Settings, Shield, Video } from "lucide-react";
+import {
+ BookCheck,
+ Database,
+ FileText,
+ Globe,
+ Search,
+ Settings,
+ Shield,
+ Video
+} from "lucide-react";
import { ProjectNavList } from "./ProjectNavLink";
import { PAM_APPROVALS_SUBMENU, PROJECT_ACCESS_CONTROL_SUBMENU } from "./submenus";
@@ -7,8 +16,9 @@ import type { NavItem, Submenu } from "./types";
export const PamNav = ({ onSubmenuOpen }: { onSubmenuOpen: (submenu: Submenu) => void }) => {
const items: NavItem[] = [
{ label: "Resources", icon: Database, pathSuffix: "resources" },
- { label: "Sessions", icon: Video, pathSuffix: "sessions" },
{ label: "Discovery", icon: Search, pathSuffix: "discovery", activeMatch: /\/discovery\// },
+ { label: "Sessions", icon: Video, pathSuffix: "sessions" },
+ { label: "Domains", icon: Globe, pathSuffix: "domains" },
{
label: "Approvals",
icon: BookCheck,
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
index 128a2522c4..bc121fd236 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
@@ -27,9 +27,9 @@ const PageContent = () => {
accountId: accountId!,
projectId: projectId!,
orgId: orgId!,
- resourceName: account?.resource.name ?? "",
+ resourceName: account?.resource?.name ?? "",
accountName: account?.name ?? "",
- resourceType: account?.resource.resourceType ?? "",
+ resourceType: account?.resource?.resourceType ?? "",
onSessionEnd: () => setSessionEnded(true)
});
@@ -98,7 +98,7 @@ const PageContent = () => {
<div className="flex items-center gap-4">
<span>
<span className="text-mineshaft-400">Resource:</span>{" "}
- <span className="text-mineshaft-300">{account.resource.name}</span>
+ <span className="text-mineshaft-300">{account.resource?.name}</span>
</span>
<span className="text-mineshaft-500">|</span>
<span>
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
index 9bf4db3950..e32ac43fd5 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx
@@ -3,7 +3,7 @@ import { Helmet } from "react-helmet";
import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useQueryClient } from "@tanstack/react-query";
-import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
+import { useNavigate, useParams } from "@tanstack/react-router";
import {
BanIcon,
EllipsisVerticalIcon,
@@ -15,7 +15,6 @@ import {
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
Button,
UnstableDropdownMenu,
@@ -40,6 +39,7 @@ import {
} from "@app/hooks/api/pam";
import { useManualRotateAccount } from "@app/hooks/api/pam/mutations";
import { pamKeys } from "@app/hooks/api/pam/queries";
+import { PAM_DOMAIN_TYPE_MAP, PamDomainType } from "@app/hooks/api/pamDomain";
import { PamAccessAccountModal } from "../PamAccountsPage/components/PamAccessAccountModal";
import { PamDeleteAccountModal } from "../PamAccountsPage/components/PamDeleteAccountModal";
@@ -52,7 +52,7 @@ import {
PamAccountDetailsSection,
PamAccountMetadataSection,
PamAccountPropertiesSection,
- PamAccountResourcesSection
+ PamSelectResourceModal
} from "./components";
const PageContent = () => {
@@ -66,35 +66,20 @@ const PageContent = () => {
orgId?: string;
resourceType?: string;
resourceId?: string;
+ domainType?: string;
+ domainId?: string;
};
- const { accountId, projectId, resourceType, resourceId } = params;
-
- const selectedTab = useSearch({
- strict: false,
- select: (el) => el.selectedTab
- });
-
- const handleTabChange = (tab: string) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
- search: (prev) => ({ ...prev, selectedTab: tab }),
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resourceType!,
- resourceId: resourceId!,
- accountId: accountId!
- }
- });
- };
+ const { accountId, projectId, resourceType, resourceId, domainType, domainId } = params;
+ const isDomainAccount = !!domainId;
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
"accessAccount",
"requestAccount",
- "deleteAccount"
+ "deleteAccount",
+ "selectResource"
] as const);
const queryClient = useQueryClient();
@@ -123,40 +108,65 @@ const PageContent = () => {
);
}
- const resourceTypeInfo = PAM_RESOURCE_TYPE_MAP[account.resource.resourceType];
+ const resourceTypeInfo = account.resource
+ ? PAM_RESOURCE_TYPE_MAP[account.resource.resourceType]
+ : null;
+
+ const domainTypeInfo = account.domain
+ ? PAM_DOMAIN_TYPE_MAP[account.domain.domainType as PamDomainType]
+ : null;
+
+ const parentTypeInfo = resourceTypeInfo || domainTypeInfo;
const handleBack = () => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resourceType!,
- resourceId: resourceId!
- }
- });
+ if (isDomainAccount) {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ domainType: domainType!,
+ domainId: domainId!
+ }
+ });
+ } else {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ resourceType: resourceType!,
+ resourceId: resourceId!
+ }
+ });
+ }
};
const handleAccess = async () => {
+ if (isDomainAccount && account.domain) {
+ handlePopUpOpen("selectResource");
+ return;
+ }
+
const { requiresApproval } = await checkPolicyMatch({
policyType: ApprovalPolicyType.PamAccess,
projectId: projectId!,
inputs: {
- resourceName: account.resource.name,
+ resourceName: account.resource?.name ?? "",
accountName: account.name
}
});
if (requiresApproval) {
handlePopUpOpen("requestAccount", {
- resourceName: account.resource.name,
+ resourceName: account.resource?.name ?? "",
accountName: account.name,
accountAccessed: true
});
return;
}
- if (account.resource.resourceType === PamResourceType.AwsIam) {
+ if (account.resource?.resourceType === PamResourceType.AwsIam) {
accessAwsIam(account);
} else {
handlePopUpOpen("accessAccount", { account });
@@ -197,40 +207,42 @@ const PageContent = () => {
className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
>
<FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
- Back to resource
+ {isDomainAccount ? "Back to domain" : "Back to resource"}
</button>
<div className="mb-6 flex items-center justify-between">
<div className="flex items-center gap-4">
- <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
- <img
- alt={resourceTypeInfo.name}
- src={`/images/integrations/${resourceTypeInfo.image}`}
- className="size-6"
- />
- </div>
+ {parentTypeInfo && (
+ <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
+ <img
+ alt={parentTypeInfo.name}
+ src={`/images/integrations/${parentTypeInfo.image}`}
+ className="size-6"
+ />
+ </div>
+ )}
<div>
<h1 className="text-2xl font-semibold text-mineshaft-100">{account.name}</h1>
<p className="text-sm text-bunker-300">
- {resourceTypeInfo.name} Account on {account.resource.name}
+ {account.domain
+ ? `${account.domain.domainType === "active-directory" ? "Active Directory" : account.domain.domainType} Account on ${account.domain.name}`
+ : `${resourceTypeInfo?.name ?? ""} Account on ${account.resource?.name ?? ""}`}
</p>
</div>
</div>
<div className="flex items-center gap-3">
- {/* Windows Server accounts cannot be accessed temporarily */}
- {/* Active Directory accounts cannot be accessed */}
- {account.resource.resourceType !== PamResourceType.Windows &&
- account.resource.resourceType !== PamResourceType.ActiveDirectory && (
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
- >
- <Button variant="neutral" onClick={handleAccess} isPending={isAwsAccessPending}>
- <LogInIcon />
- Access
- </Button>
- </ProjectPermissionCan>
- )}
+ {/* TODO: Disabled for Windows Server and Active Directory accounts until RDP is implemented */}
+ {!isDomainAccount && account.resource?.resourceType !== PamResourceType.Windows && (
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Access}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ <Button variant="neutral" onClick={handleAccess} isPending={isAwsAccessPending}>
+ <LogInIcon />
+ Access
+ </Button>
+ </ProjectPermissionCan>
+ )}
<UnstableDropdownMenu>
<UnstableDropdownMenuTrigger asChild>
<Button variant="outline" size="sm">
@@ -252,7 +264,7 @@ const PageContent = () => {
</UnstableDropdownMenuItem>
)}
</ProjectPermissionCan>
- {account.resource.rotationCredentialsConfigured && (
+ {account.resource?.rotationCredentialsConfigured && (
<ProjectPermissionCan
I={ProjectPermissionPamAccountActions.TriggerRotation}
a={ProjectPermissionSub.PamAccounts}
@@ -299,20 +311,8 @@ const PageContent = () => {
<PamAccountMetadataSection account={account} />
</div>
- {/* Right Column - Tabbed Content */}
<div className="min-w-0 flex-1">
- <Tabs value={selectedTab} onValueChange={handleTabChange}>
- <TabList>
- <Tab value="resources">Resources</Tab>
- <Tab value="dependencies">Dependencies</Tab>
- </TabList>
- <TabPanel value="resources">
- <PamAccountResourcesSection account={account} onAccessResource={handleAccess} />
- </TabPanel>
- <TabPanel value="dependencies">
- <PamAccountDependenciesSection account={account} />
- </TabPanel>
- </Tabs>
+ <PamAccountDependenciesSection account={account} />
</div>
</div>
@@ -343,6 +343,18 @@ const PageContent = () => {
account={popUp.deleteAccount.data}
onDeleted={handleBack}
/>
+
+ {isDomainAccount && account.domain && (
+ <PamSelectResourceModal
+ isOpen={popUp.selectResource.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("selectResource", isOpen)}
+ domainType={account.domain.domainType}
+ domainId={account.domain.id}
+ onSelect={(resource) => {
+ handlePopUpOpen("accessAccount", { account, resource });
+ }}
+ />
+ )}
</div>
);
};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
index c6f96a9ac3..d61f76b4ff 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountCredentialsSection.tsx
@@ -13,16 +13,12 @@ import {
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
import { useTimedReset } from "@app/hooks";
-import {
- PamResourceType,
- TActiveDirectoryAccount,
- TPamAccount,
- TWindowsAccount
-} from "@app/hooks/api/pam";
+import { PamResourceType, TPamAccount, TWindowsAccount } from "@app/hooks/api/pam";
import { TPamAccountCredentialsResponse } from "@app/hooks/api/pam/queries";
import { TAwsIamCredentials } from "@app/hooks/api/pam/types/aws-iam-resource";
import { TBaseSqlCredentials } from "@app/hooks/api/pam/types/shared/sql-resource";
import { SSHAuthMethod, TSSHCredentials } from "@app/hooks/api/pam/types/ssh-resource";
+import { TActiveDirectoryAccount } from "@app/hooks/api/pamDomain/active-directory-types";
import { SensitiveCredentialsGate } from "./SensitiveCredentialsGate";
import { useCredentialsReveal } from "./useCredentialsReveal";
@@ -100,7 +96,7 @@ const ActiveDirectoryCredentialsContent = ({ account }: { account: TActiveDirect
<>
<Detail>
<DetailLabel>Account Type</DetailLabel>
- <DetailValue className="capitalize">{account.internalMetadata.accountType}</DetailValue>
+ <DetailValue className="capitalize">{account.internalMetadata?.accountType}</DetailValue>
</Detail>
<CopyableField label="Username" value={account.credentials.username} />
</>
@@ -108,6 +104,20 @@ const ActiveDirectoryCredentialsContent = ({ account }: { account: TActiveDirect
};
const CredentialsContent = ({ account }: { account: TPamAccount }) => {
+ if (account.domain) {
+ switch (account.domain.domainType) {
+ case "active-directory":
+ return (
+ <ActiveDirectoryCredentialsContent
+ account={account as unknown as TActiveDirectoryAccount}
+ />
+ );
+ default:
+ return null;
+ }
+ }
+
+ if (!account.resource) return null;
const { resourceType } = account.resource;
switch (resourceType) {
@@ -123,8 +133,6 @@ const CredentialsContent = ({ account }: { account: TPamAccount }) => {
return <AwsIamCredentialsContent credentials={account.credentials as TAwsIamCredentials} />;
case PamResourceType.Windows:
return <WindowsCredentialsContent account={account as TWindowsAccount} />;
- case PamResourceType.ActiveDirectory:
- return <ActiveDirectoryCredentialsContent account={account as TActiveDirectoryAccount} />;
default:
return null;
}
@@ -212,6 +220,16 @@ type SensitiveFieldDef = {
// Non-sensitive fields (username, auth method, etc.) are already shown by CredentialsContent above.
// When adding a new resource type, add a case here if it has credentials hidden from the sanitized view.
const getSensitiveFieldDefs = (account: TPamAccount): SensitiveFieldDef[] => {
+ if (account.domain) {
+ switch (account.domain.domainType) {
+ case "active-directory":
+ return [{ key: "password", label: "Password" }];
+ default:
+ return [];
+ }
+ }
+
+ if (!account.resource) return [];
const { resourceType } = account.resource;
switch (resourceType) {
@@ -221,7 +239,6 @@ const getSensitiveFieldDefs = (account: TPamAccount): SensitiveFieldDef[] => {
case PamResourceType.MongoDB:
case PamResourceType.Redis:
case PamResourceType.Windows:
- case PamResourceType.ActiveDirectory:
return [{ key: "password", label: "Password" }];
case PamResourceType.SSH: {
@@ -279,7 +296,7 @@ export const PamAccountCredentialsSection = ({ account, onEdit }: Props) => {
if (
Object.keys(account.credentials).length <= 0 ||
- [PamResourceType.Kubernetes].includes(account.resource.resourceType)
+ [PamResourceType.Kubernetes].includes(account.resource?.resourceType as PamResourceType)
)
return null;
@@ -306,8 +323,8 @@ export const PamAccountCredentialsSection = ({ account, onEdit }: Props) => {
<SensitiveCredentialsGate
state={state}
accountName={account.name}
- resourceName={account.resource.name}
- resourceType={account.resource.resourceType}
+ resourceName={account.resource?.name ?? ""}
+ resourceType={account.resource?.resourceType ?? ("" as PamResourceType)}
metadata={account.metadata}
onReveal={() => {
if (!account.credentialsConfigured) {
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx
index 5a4d46de4a..c57920d30b 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDependenciesSection.tsx
@@ -7,11 +7,14 @@ export const PamAccountDependenciesSection = ({ account }: { account: TPamAccoun
const { data: dependencies, isPending } = useGetPamAccountDependencies(account.id);
return (
- <PamDependenciesTable
- dependencies={dependencies}
- isPending={isPending}
- contextColumnLabel="Resource"
- getContextValue={(dep) => dep.resourceName}
- />
+ <div>
+ <h2 className="mb-4 text-xl font-semibold">Services & Tasks</h2>
+ <PamDependenciesTable
+ dependencies={dependencies}
+ isPending={isPending}
+ contextColumnLabel="Resource"
+ getContextValue={(dep) => dep.resourceName}
+ />
+ </div>
);
};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
index 5bf3154130..fe68cc5531 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
@@ -51,7 +51,9 @@ const rotationStatusLabel = (status?: string | null) => {
};
export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
- const resourceTypeInfo = PAM_RESOURCE_TYPE_MAP[account.resource.resourceType];
+ const resourceTypeInfo = account.resource
+ ? PAM_RESOURCE_TYPE_MAP[account.resource.resourceType]
+ : null;
const isRotating = account.rotationStatus === PamAccountRotationStatus.Rotating;
// Poll for status updates while rotation is in progress
@@ -83,22 +85,24 @@ export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
<DetailLabel>Description</DetailLabel>
<DetailValue>{account.description || "-"}</DetailValue>
</Detail>
- <Detail>
- <DetailLabel>Type</DetailLabel>
- <DetailValue>
- <div className="flex items-center gap-2">
- <img
- alt={resourceTypeInfo.name}
- src={`/images/integrations/${resourceTypeInfo.image}`}
- className="size-4"
- />
- {resourceTypeInfo.name} Account
- </div>
- </DetailValue>
- </Detail>
+ {resourceTypeInfo && (
+ <Detail>
+ <DetailLabel>Type</DetailLabel>
+ <DetailValue>
+ <div className="flex items-center gap-2">
+ <img
+ alt={resourceTypeInfo.name}
+ src={`/images/integrations/${resourceTypeInfo.image}`}
+ className="size-4"
+ />
+ {resourceTypeInfo.name} Account
+ </div>
+ </DetailValue>
+ </Detail>
+ )}
<Detail>
<DetailLabel>Parent Resource</DetailLabel>
- <DetailValue>{account.resource.name}</DetailValue>
+ <DetailValue>{account.resource?.name ?? "—"}</DetailValue>
</Detail>
<Detail>
<DetailLabel>Created</DetailLabel>
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx
index 0756725d2e..04a28f4860 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountMetadataSection.tsx
@@ -56,7 +56,7 @@ export const PamAccountMetadataSection = ({ account }: Props) => {
try {
await updateAccount({
accountId: account.id,
- resourceType: account.resource.resourceType,
+ parentType: account.parentType,
metadata: formData.metadata || []
});
createNotification({
@@ -71,7 +71,7 @@ export const PamAccountMetadataSection = ({ account }: Props) => {
});
}
},
- [account.id, account.resource.resourceType, updateAccount]
+ [account.id, account.resource?.resourceType, updateAccount]
);
return (
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx
index a695937f61..97c9038ee2 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx
@@ -9,12 +9,7 @@ import {
UnstableIconButton,
UnstableInput
} from "@app/components/v3";
-import {
- PamResourceType,
- TActiveDirectoryAccount,
- TPamAccount,
- TWindowsAccount
-} from "@app/hooks/api/pam";
+import { PamResourceType, TPamAccount, TWindowsAccount } from "@app/hooks/api/pam";
const CopyableField = ({ label, value }: { label: string; value: string }) => {
const handleCopy = () => {
@@ -47,30 +42,8 @@ type TPropertyField = {
};
const getAccountProperties = (account: TPamAccount): TPropertyField[] => {
+ if (!account.resource) return [];
switch (account.resource.resourceType) {
- case PamResourceType.ActiveDirectory: {
- const { internalMetadata } = account as TActiveDirectoryAccount;
- const fields: TPropertyField[] = [];
-
- if (internalMetadata.userPrincipalName) {
- fields.push({ label: "User Principal Name", value: internalMetadata.userPrincipalName });
- }
- if (internalMetadata.adGuid) {
- fields.push({ label: "AD GUID", value: internalMetadata.adGuid });
- }
- if (internalMetadata.passwordLastSet) {
- fields.push({
- label: "Password Last Set",
- value: internalMetadata.passwordLastSet,
- type: "date"
- });
- }
- if (internalMetadata.lastLogon) {
- fields.push({ label: "Last Logon", value: internalMetadata.lastLogon, type: "date" });
- }
-
- return fields;
- }
case PamResourceType.Windows: {
const { internalMetadata } = account as TWindowsAccount;
const fields: TPropertyField[] = [];
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx
index ffd23e1938..e382c80f25 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountResourcesSection.tsx
@@ -1,7 +1,7 @@
import { MonitorIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { PamResourceType, TPamAccount, useListRelatedResources } from "@app/hooks/api/pam";
+import { PamResourceType, TPamAccount } from "@app/hooks/api/pam";
type Props = {
account: TPamAccount;
@@ -34,52 +34,10 @@ const ResourceCard = ({ name, resourceId, onAccess }: ResourceCardProps) => {
);
};
-const ActiveDirectoryAccountResources = ({ account, onAccessResource }: Props) => {
- const { resource } = account;
-
- // For AD accounts, show all domain member resources (excluding the AD server itself)
- const { data: relatedResources, isPending } = useListRelatedResources(resource.id);
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="border-b border-border px-4 py-3">
- <h3 className="text-lg font-medium">Resources</h3>
- <p className="text-sm text-muted">Domain machines this account can access</p>
- </div>
- <div className="p-4">
- {isPending && <p className="text-sm text-muted">Loading resources...</p>}
- {!isPending && (!relatedResources || relatedResources.length === 0) && (
- <p className="py-4 text-center text-sm text-muted">No domain resources found</p>
- )}
- {relatedResources && relatedResources.length > 0 && (
- // Temporarily disable connecting to AD accounts
- <div className="pointer-events-none grid grid-cols-1 gap-4 opacity-60 md:grid-cols-2">
- {relatedResources.map((relatedResource) => {
- return (
- <ResourceCard
- key={relatedResource.id}
- name={relatedResource.name}
- resourceId={relatedResource.id}
- onAccess={() => onAccessResource(relatedResource.id)}
- />
- );
- })}
- </div>
- )}
- </div>
- </div>
- );
-};
-
export const PamAccountResourcesSection = ({ account, onAccessResource }: Props) => {
const { resource } = account;
- // For Active Directory accounts, show related domain resources instead
- if (resource.resourceType === PamResourceType.ActiveDirectory) {
- return (
- <ActiveDirectoryAccountResources account={account} onAccessResource={onAccessResource} />
- );
- }
+ if (!resource) return null;
return (
<div className="rounded-lg border border-border bg-container">
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx
new file mode 100644
index 0000000000..01a5736a5d
--- /dev/null
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamSelectResourceModal.tsx
@@ -0,0 +1,92 @@
+import { useState } from "react";
+
+import { Button, Modal, ModalContent, Select, SelectItem } from "@app/components/v2";
+import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
+import { TPamDomainRelatedResource, useListDomainRelatedResources } from "@app/hooks/api/pamDomain";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ domainType: string;
+ domainId: string;
+ onSelect: (resource: TPamDomainRelatedResource) => void;
+};
+
+export const PamSelectResourceModal = ({
+ isOpen,
+ onOpenChange,
+ domainType,
+ domainId,
+ onSelect
+}: Props) => {
+ const [selectedResourceId, setSelectedResourceId] = useState<string>("");
+ const { data: resources } = useListDomainRelatedResources(domainType, domainId, {
+ enabled: isOpen
+ });
+
+ const handleAccess = () => {
+ const resource = resources?.find((r) => r.id === selectedResourceId);
+ if (resource) {
+ onSelect(resource);
+ onOpenChange(false);
+ setSelectedResourceId("");
+ }
+ };
+
+ return (
+ <Modal
+ isOpen={isOpen}
+ onOpenChange={(open) => {
+ onOpenChange(open);
+ if (!open) setSelectedResourceId("");
+ }}
+ >
+ <ModalContent
+ title="Access Account"
+ subTitle="Select a resource to access this domain account on."
+ >
+ <div className="mt-2">
+ <Select
+ value={selectedResourceId}
+ onValueChange={setSelectedResourceId}
+ placeholder="Select a resource..."
+ className="w-full"
+ position="popper"
+ >
+ {(resources || []).map((resource) => {
+ const typeInfo = PAM_RESOURCE_TYPE_MAP[resource.resourceType as PamResourceType];
+ return (
+ <SelectItem key={resource.id} value={resource.id}>
+ <div className="flex items-center gap-2">
+ {typeInfo?.image && (
+ <img
+ alt={typeInfo.name}
+ src={`/images/integrations/${typeInfo.image}`}
+ className="size-4"
+ />
+ )}
+ {resource.name}
+ </div>
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </div>
+ <div className="mt-4 flex gap-2">
+ <Button onClick={handleAccess} isDisabled={!selectedResourceId} colorSchema="primary">
+ Access
+ </Button>
+ <Button
+ variant="outline_bg"
+ onClick={() => {
+ onOpenChange(false);
+ setSelectedResourceId("");
+ }}
+ >
+ Cancel
+ </Button>
+ </div>
+ </ModalContent>
+ </Modal>
+ );
+};
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts b/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts
index 6e665fc588..f22b6ae9a8 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts
@@ -4,3 +4,4 @@ export { PamAccountDetailsSection } from "./PamAccountDetailsSection";
export { PamAccountMetadataSection } from "./PamAccountMetadataSection";
export { PamAccountPropertiesSection } from "./PamAccountPropertiesSection";
export { PamAccountResourcesSection } from "./PamAccountResourcesSection";
+export { PamSelectResourceModal } from "./PamSelectResourceModal";
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/route.tsx b/frontend/src/pages/pam/PamAccountByIDPage/route.tsx
index 7ae205c636..1e89f2526f 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/route.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/route.tsx
@@ -1,26 +1,11 @@
-import { createFileRoute, linkOptions, stripSearchParams } from "@tanstack/react-router";
-import { zodValidator } from "@tanstack/zod-adapter";
-import { z } from "zod";
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
import { PamAccountByIDPage } from "./PamAccountByIDPage";
-export enum AccountDetailTab {
- Resources = "resources",
- Dependencies = "dependencies"
-}
-
-const AccountDetailSearchSchema = z.object({
- selectedTab: z.nativeEnum(AccountDetailTab).catch(AccountDetailTab.Resources)
-});
-
export const Route = createFileRoute(
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/"
)({
- validateSearch: zodValidator(AccountDetailSearchSchema),
component: PamAccountByIDPage,
- search: {
- middlewares: [stripSearchParams({ selectedTab: AccountDetailTab.Resources })]
- },
beforeLoad: ({ context, params }) => {
return {
breadcrumbs: [
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
index 1c60cf568c..501c394f61 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccessAccountModal.tsx
@@ -70,6 +70,8 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account, projectId
const command = useMemo(() => {
if (!account) return "";
+ if (!account.resource) return "";
+
switch (account.resource.resourceType) {
case PamResourceType.Postgres:
case PamResourceType.MySQL:
@@ -90,11 +92,11 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account, projectId
if (!account) return null;
const showWebAccess =
- account.resource.resourceType === PamResourceType.Postgres ||
- account.resource.resourceType === PamResourceType.SSH ||
- account.resource.resourceType === PamResourceType.Redis;
+ account.resource?.resourceType === PamResourceType.Postgres ||
+ account.resource?.resourceType === PamResourceType.SSH ||
+ account.resource?.resourceType === PamResourceType.Redis;
- const showDataExplorer = account.resource.resourceType === PamResourceType.Postgres;
+ const showDataExplorer = account.resource?.resourceType === PamResourceType.Postgres;
return (
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
@@ -168,8 +170,8 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account, projectId
params={{
orgId: currentOrg.id,
projectId,
- resourceType: account.resource.resourceType,
- resourceId: account.resource.id,
+ resourceType: account.resource?.resourceType ?? "",
+ resourceId: account.resource?.id ?? "",
accountId: account.id
}}
target="_blank"
@@ -184,8 +186,8 @@ export const PamAccessAccountModal = ({ isOpen, onOpenChange, account, projectId
params={{
orgId: currentOrg.id,
projectId,
- resourceType: account.resource.resourceType,
- resourceId: account.resource.id,
+ resourceType: account.resource?.resourceType ?? "",
+ resourceId: account.resource?.id ?? "",
accountId: account.id
}}
target="_blank"
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx
index 9d88c426c9..04da5834eb 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm.tsx
@@ -5,9 +5,11 @@ import { z } from "zod";
import { FormControl, Input, Select, SelectItem } from "@app/components/v2";
import { Button, SheetFooter } from "@app/components/v3";
-import { PamResourceType, TActiveDirectoryAccount } from "@app/hooks/api/pam";
import { UNCHANGED_PASSWORD_SENTINEL } from "@app/hooks/api/pam/constants";
-import { ActiveDirectoryAccountType } from "@app/hooks/api/pam/types/active-directory-resource";
+import {
+ ActiveDirectoryAccountType,
+ TActiveDirectoryAccount
+} from "@app/hooks/api/pamDomain/active-directory-types";
import { GenericAccountFields, genericAccountFieldsSchema } from "./GenericAccountFields";
import { MetadataFields } from "./MetadataFields";
@@ -15,8 +17,6 @@ import { RequireMfaField } from "./RequireMfaField";
type Props = {
account?: TActiveDirectoryAccount;
- resourceId?: string;
- resourceType?: PamResourceType;
onSubmit: (formData: FormData) => Promise<void>;
closeSheet: () => void;
};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx
index e440e6afd6..192bf5fb86 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/PamAccountForm.tsx
@@ -5,6 +5,7 @@ import {
useCreatePamAccount,
useUpdatePamAccount
} from "@app/hooks/api/pam";
+import { PamDomainType } from "@app/hooks/api/pamDomain";
import { DiscriminativePick } from "@app/types";
import { ActiveDirectoryAccountForm } from "./ActiveDirectoryAccountForm";
@@ -56,7 +57,7 @@ const CreateForm = ({
...rest,
folderId,
resourceId,
- resourceType,
+ parentType: resourceType,
projectId,
internalMetadata
});
@@ -149,15 +150,6 @@ const CreateForm = ({
resourceType={resourceType}
/>
);
- case PamResourceType.ActiveDirectory:
- return (
- <ActiveDirectoryAccountForm
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- resourceId={resourceId}
- resourceType={resourceType}
- />
- );
default:
throw new Error(`Unhandled resource: ${resourceType}`);
}
@@ -178,7 +170,7 @@ const UpdateForm = ({ account, closeSheet }: UpdateFormProps) => {
const { internalMetadata, ...rest } = formData;
const updatedAccount = await updatePamAccount.mutateAsync({
accountId: account.id,
- resourceType: account.resource.resourceType,
+ parentType: account.parentType,
...rest,
internalMetadata
});
@@ -189,7 +181,7 @@ const UpdateForm = ({ account, closeSheet }: UpdateFormProps) => {
closeSheet(updatedAccount);
};
- switch (account.resource.resourceType) {
+ switch (account.parentType) {
case PamResourceType.Postgres:
return (
<PostgresAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
@@ -234,7 +226,7 @@ const UpdateForm = ({ account, closeSheet }: UpdateFormProps) => {
return (
<WindowsAccountForm account={account as any} onSubmit={onSubmit} closeSheet={closeSheet} />
);
- case PamResourceType.ActiveDirectory:
+ case PamDomainType.ActiveDirectory:
return (
<ActiveDirectoryAccountForm
account={account as any}
@@ -243,7 +235,7 @@ const UpdateForm = ({ account, closeSheet }: UpdateFormProps) => {
/>
);
default:
- throw new Error(`Unhandled resource: ${account.resource.resourceType}`);
+ throw new Error(`Unhandled account type: ${account.parentType}`);
}
};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx
index 5c1ca707d9..c15dbcf8c7 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/SshAccountForm.tsx
@@ -187,7 +187,7 @@ const SshAccountFields = ({ isUpdate, resourceId }: { isUpdate: boolean; resourc
export const SshAccountForm = ({ account, resourceId, onSubmit, closeSheet }: Props) => {
const isUpdate = Boolean(account);
- const effectiveResourceId = resourceId || account?.resource.id || "";
+ const effectiveResourceId = resourceId || account?.resource?.id || "";
const getDefaultCredentials = () => {
if (!account) return undefined;
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx
index 734c3a69f8..c89751b73a 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamDeleteAccountModal.tsx
@@ -12,18 +12,14 @@ type Props = {
export const PamDeleteAccountModal = ({ isOpen, onOpenChange, account, onDeleted }: Props) => {
const deletePamAccount = useDeletePamAccount();
- if (!account) return null;
+ if (!account || !account.parentType) return null;
- const {
- id: accountId,
- name,
- resource: { resourceType }
- } = account;
+ const { id: accountId, name, parentType } = account;
const handleDelete = async () => {
await deletePamAccount.mutateAsync({
accountId,
- resourceType
+ parentType
});
createNotification({
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/useAccessAwsIamAccount.tsx b/frontend/src/pages/pam/PamAccountsPage/components/useAccessAwsIamAccount.tsx
index 4d9cd9b642..bda8e61733 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/useAccessAwsIamAccount.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/useAccessAwsIamAccount.tsx
@@ -9,7 +9,7 @@ export const useAccessAwsIamAccount = () => {
const [loadingAccountId, setLoadingAccountId] = useState<string | null>(null);
const accessAwsIam = async (account: TPamAccount) => {
- if (account.resource.resourceType !== PamResourceType.AwsIam) {
+ if (account.resource?.resourceType !== PamResourceType.AwsIam) {
return false;
}
@@ -18,7 +18,7 @@ export const useAccessAwsIamAccount = () => {
try {
const response = await accessPamAccount.mutateAsync({
accountId: account.id,
- resourceName: account.resource.name,
+ resourceName: account.resource?.name ?? "",
accountName: account.name,
projectId: account.projectId,
duration: `${(account.credentials as TAwsIamCredentials).defaultSessionDuration}s`
diff --git a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx b/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx
index 4ef0ac4486..a051dbeaaf 100644
--- a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx
+++ b/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx
@@ -55,7 +55,6 @@ import { ProjectPermissionSub, useOrganization } from "@app/context";
import { ProjectPermissionPamDiscoveryActions } from "@app/context/ProjectPermissionContext/types";
import { usePagination } from "@app/hooks";
import { gatewaysQueryKeys } from "@app/hooks/api";
-import { PamResourceType } from "@app/hooks/api/pam";
import type {
TPamDiscoverySource,
TPamDiscoverySourceRunProgress
@@ -70,6 +69,7 @@ import {
useListPamDiscoverySourceRuns,
useTriggerPamDiscoveryScan
} from "@app/hooks/api/pamDiscovery";
+import { PAM_DOMAIN_TYPE_MAP, PamDomainType, useListPamDomains } from "@app/hooks/api/pamDomain";
import { PamUpdateDiscoverySourceModal } from "../PamDiscoveryPage/components/PamUpdateDiscoverySourceModal";
@@ -266,6 +266,72 @@ const DiscoveryCredentialsSection = ({
);
};
+const DiscoveryDomainSection = ({
+ source,
+ projectId,
+ orgId
+}: {
+ source: TPamDiscoverySource;
+ projectId: string;
+ orgId: string;
+}) => {
+ const navigate = useNavigate();
+ const domainFQDN = source.discoveryConfiguration?.domainFQDN as string | undefined;
+ const fingerprint = domainFQDN?.toLowerCase();
+
+ const { data: domainsData } = useListPamDomains({
+ projectId,
+ discoveryFingerprint: fingerprint
+ });
+
+ const domain = domainsData?.domains[0];
+
+ const domainTypeInfo = domain
+ ? PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP]
+ : null;
+
+ return (
+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
+ <div className="border-b border-border pb-2">
+ <h3 className="text-lg font-medium">Domain</h3>
+ </div>
+ {domain ? (
+ <button
+ type="button"
+ className="flex items-center gap-3 rounded-md p-2 text-left transition-colors hover:bg-mineshaft-700"
+ onClick={() =>
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
+ params: {
+ orgId,
+ projectId,
+ domainType: domain.domainType,
+ domainId: domain.id
+ }
+ })
+ }
+ >
+ {domainTypeInfo?.image && (
+ <img
+ alt={domainTypeInfo.name}
+ src={`/images/integrations/${domainTypeInfo.image}`}
+ className="size-6"
+ />
+ )}
+ <div>
+ <p className="text-sm font-medium text-mineshaft-100">{domain.name}</p>
+ <p className="text-xs text-muted">{domainTypeInfo?.name}</p>
+ </div>
+ </button>
+ ) : (
+ <p className="text-sm text-muted">
+ No domain has been created yet. Run a scan to automatically create the domain.
+ </p>
+ )}
+ </div>
+ );
+};
+
const formatDuration = (startedAt?: string | null, completedAt?: string | null): string => {
if (!startedAt) return "-";
const end = completedAt ? new Date(completedAt) : new Date();
@@ -861,7 +927,7 @@ const AccountsTab = ({
</UnstableTableCell>
<UnstableTableCell>
<div className="flex items-center gap-2">
- {account.resourceType === PamResourceType.ActiveDirectory && (
+ {account.resourceType === PamDomainType.ActiveDirectory && (
<Badge variant="info">AD</Badge>
)}
<span className="text-muted capitalize">
@@ -1074,6 +1140,7 @@ const PageContent = () => {
{/* Left Column */}
<div className="flex w-80 shrink-0 flex-col gap-4">
<DiscoveryDetailsSection source={source} onEdit={() => setIsEditModalOpen(true)} />
+ <DiscoveryDomainSection source={source} projectId={projectId!} orgId={currentOrg.id} />
<DiscoveryConfigurationSection source={source} onEdit={() => setIsEditModalOpen(true)} />
<DiscoveryCredentialsSection source={source} onEdit={() => setIsEditModalOpen(true)} />
</div>
diff --git a/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx b/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx
new file mode 100644
index 0000000000..84900c7f86
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainAccountByIDPage/route.tsx
@@ -0,0 +1,38 @@
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+
+import { PamAccountByIDPage } from "../PamAccountByIDPage/PamAccountByIDPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/"
+)({
+ component: PamAccountByIDPage,
+ beforeLoad: ({ context, params }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Domains",
+ link: linkOptions({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains",
+ params: { orgId: params.orgId, projectId: params.projectId }
+ })
+ },
+ {
+ label: "Domain",
+ link: linkOptions({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
+ params: {
+ orgId: params.orgId,
+ projectId: params.projectId,
+ domainType: params.domainType,
+ domainId: params.domainId
+ }
+ })
+ },
+ {
+ label: "Account Details"
+ }
+ ]
+ };
+ }
+});
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx b/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx
new file mode 100644
index 0000000000..b465791cad
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/PamDomainByIDPage.tsx
@@ -0,0 +1,236 @@
+import { useState } from "react";
+import { Helmet } from "react-helmet";
+import { faChevronLeft } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
+import { BanIcon, EllipsisVerticalIcon } from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { DeleteActionModal, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import {
+ Button,
+ UnstableDropdownMenu,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
+ UnstablePageLoader
+} from "@app/components/v3";
+import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
+import {
+ PAM_DOMAIN_TYPE_MAP,
+ PamDomainType,
+ useDeletePamDomain,
+ useGetPamDomainById
+} from "@app/hooks/api/pamDomain";
+
+import {
+ PamDomainAccountsSection,
+ PamDomainConnectionSection,
+ PamDomainDetailsSection,
+ PamDomainMetadataSection,
+ PamDomainRelatedResourcesSection,
+ PamUpdateDomainModal
+} from "./components";
+
+const PageContent = () => {
+ const navigate = useNavigate();
+ const { currentOrg } = useOrganization();
+ const params = useParams({
+ strict: false
+ }) as { domainId?: string; domainType?: string; projectId?: string; orgId?: string };
+
+ const { domainId, domainType, projectId } = params;
+
+ const selectedTab = useSearch({
+ strict: false,
+ select: (el) => el.selectedTab
+ });
+
+ const handleTabChange = (tab: string) => {
+ navigate({
+ to: ".",
+ search: { selectedTab: tab }
+ });
+ };
+
+ const [isEditModalOpen, setIsEditModalOpen] = useState(false);
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
+
+ const { data: domain, isPending } = useGetPamDomainById(domainType as PamDomainType, domainId, {
+ enabled: Boolean(domainId) && Boolean(domainType)
+ });
+
+ const deleteDomain = useDeletePamDomain();
+
+ if (isPending) {
+ return <UnstablePageLoader />;
+ }
+
+ if (!domain) {
+ return (
+ <div className="flex h-full w-full items-center justify-center px-20">
+ <UnstableEmpty className="max-w-2xl">
+ <UnstableEmptyHeader>
+ <BanIcon className="size-8 text-muted" />
+ <UnstableEmptyTitle className="text-muted">
+ Could not find PAM Domain with ID {domainId}
+ </UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ </div>
+ );
+ }
+
+ const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
+
+ const handleBack = () => {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains",
+ params: { orgId: currentOrg.id, projectId: projectId! }
+ });
+ };
+
+ const handleDeleteConfirm = async () => {
+ if (!domain) return;
+
+ try {
+ await deleteDomain.mutateAsync({
+ domainId: domain.id,
+ domainType: domain.domainType
+ });
+ createNotification({
+ text: `Domain "${domain.name}" deleted successfully`,
+ type: "success"
+ });
+ handleBack();
+ } catch (error) {
+ console.error("Failed to delete domain:", error);
+ createNotification({
+ text: "Failed to delete domain",
+ type: "error"
+ });
+ }
+ };
+
+ return (
+ <div className="container mx-auto flex max-w-7xl flex-col px-6 py-6 text-mineshaft-50">
+ <button
+ type="button"
+ onClick={handleBack}
+ className="mb-4 flex items-center gap-1 text-sm text-bunker-300 hover:text-primary-400"
+ >
+ <FontAwesomeIcon icon={faChevronLeft} className="text-xs" />
+ Domains
+ </button>
+
+ <div className="mb-6 flex items-center justify-between">
+ <div className="flex items-center gap-4">
+ <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-mineshaft-700">
+ <img
+ alt={domainTypeInfo.name}
+ src={`/images/integrations/${domainTypeInfo.image}`}
+ className="size-6"
+ />
+ </div>
+ <div>
+ <h1 className="text-2xl font-semibold text-mineshaft-100">{domain.name}</h1>
+ <p className="text-sm text-bunker-300">{domainTypeInfo.name} Domain</p>
+ </div>
+ </div>
+ <div className="flex items-center gap-3">
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <Button variant="outline" size="sm">
+ <EllipsisVerticalIcon />
+ </Button>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent align="end" sideOffset={2}>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.PamDomains}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ onClick={() => setIsEditModalOpen(true)}
+ isDisabled={!isAllowed}
+ >
+ Edit Domain
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.PamDomains}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ onClick={() => setIsDeleteModalOpen(true)}
+ variant="danger"
+ isDisabled={!isAllowed}
+ >
+ Delete Domain
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </div>
+ </div>
+
+ <div className="flex gap-6">
+ {/* Left Column */}
+ <div className="flex w-80 shrink-0 flex-col gap-4">
+ <PamDomainDetailsSection domain={domain} onEdit={() => setIsEditModalOpen(true)} />
+ <PamDomainConnectionSection domain={domain} onEdit={() => setIsEditModalOpen(true)} />
+ <PamDomainMetadataSection domain={domain} />
+ </div>
+
+ {/* Right Column - Tabbed Content */}
+ <div className="min-w-0 flex-1">
+ <Tabs value={selectedTab || "accounts"} onValueChange={handleTabChange}>
+ <TabList>
+ <Tab value="accounts">Accounts</Tab>
+ <Tab value="related-resources">Resources</Tab>
+ </TabList>
+ <TabPanel value="accounts">
+ <PamDomainAccountsSection domain={domain} />
+ </TabPanel>
+ <TabPanel value="related-resources">
+ <PamDomainRelatedResourcesSection domain={domain} />
+ </TabPanel>
+ </Tabs>
+ </div>
+ </div>
+
+ <PamUpdateDomainModal
+ isOpen={isEditModalOpen}
+ onOpenChange={setIsEditModalOpen}
+ domain={domain}
+ />
+
+ <DeleteActionModal
+ isOpen={isDeleteModalOpen}
+ title={`Delete Domain ${domain.name}?`}
+ onChange={(isOpen) => setIsDeleteModalOpen(isOpen)}
+ deleteKey={domain.name}
+ onDeleteApproved={handleDeleteConfirm}
+ />
+ </div>
+ );
+};
+
+export const PamDomainByIDPage = () => {
+ return (
+ <>
+ <Helmet>
+ <title>PAM Domain | Infisical</title>
+ <link rel="icon" href="/infisical.ico" />
+ </Helmet>
+ <PageContent />
+ </>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx
new file mode 100644
index 0000000000..c604b8d507
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamAddDomainAccountModal.tsx
@@ -0,0 +1,65 @@
+import { createNotification } from "@app/components/notifications";
+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
+import { useCreatePamAccount } from "@app/hooks/api/pam";
+import { PAM_DOMAIN_TYPE_MAP, PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
+
+import { ActiveDirectoryAccountForm } from "../../PamAccountsPage/components/PamAccountForm/ActiveDirectoryAccountForm";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ projectId: string;
+ domain: TPamDomain;
+};
+
+export const PamAddDomainAccountModal = ({ isOpen, onOpenChange, projectId, domain }: Props) => {
+ const createPamAccount = useCreatePamAccount();
+ const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
+
+ const handleSubmit = async (formData: Record<string, unknown>) => {
+ try {
+ await createPamAccount.mutateAsync({
+ ...formData,
+ parentType: domain.domainType,
+ domainId: domain.id,
+ projectId
+ } as any);
+ createNotification({
+ text: "Successfully created account",
+ type: "success"
+ });
+ onOpenChange(false);
+ } catch {
+ createNotification({
+ text: "Failed to create account",
+ type: "error"
+ });
+ }
+ };
+
+ const renderForm = () => {
+ switch (domain.domainType) {
+ case PamDomainType.ActiveDirectory:
+ return (
+ <ActiveDirectoryAccountForm
+ onSubmit={handleSubmit as any}
+ closeSheet={() => onOpenChange(false)}
+ />
+ );
+ default:
+ throw new Error(`Unhandled domain type: ${domain.domainType}`);
+ }
+ };
+
+ return (
+ <Sheet open={isOpen} onOpenChange={onOpenChange}>
+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
+ <SheetHeader className="border-b">
+ <SheetTitle>Create Domain Account</SheetTitle>
+ <SheetDescription>Add an account to this {domainTypeInfo?.name} domain</SheetDescription>
+ </SheetHeader>
+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden">{renderForm()}</div>
+ </SheetContent>
+ </Sheet>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx
new file mode 100644
index 0000000000..e53a2b62df
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainAccountsSection.tsx
@@ -0,0 +1,284 @@
+import { useCallback, useState } from "react";
+import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useNavigate, useParams } from "@tanstack/react-router";
+import {
+ CheckIcon,
+ CopyIcon,
+ EllipsisVerticalIcon,
+ KeyRoundIcon,
+ PencilIcon,
+ PlusIcon,
+ TrashIcon
+} from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { Input as V2Input } from "@app/components/v2";
+import {
+ Badge,
+ Button,
+ UnstableDropdownMenu,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
+ UnstableIconButton,
+ UnstableTable,
+ UnstableTableBody,
+ UnstableTableCell,
+ UnstableTableHead,
+ UnstableTableHeader,
+ UnstableTableRow
+} from "@app/components/v3";
+import { ProjectPermissionSub, useOrganization } from "@app/context";
+import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
+import { useDebounce, usePopUp, useToggle } from "@app/hooks";
+import { TPamAccount, useListPamAccounts } from "@app/hooks/api/pam";
+import { TPamDomain } from "@app/hooks/api/pamDomain";
+
+import { PamDeleteAccountModal } from "../../PamAccountsPage/components/PamDeleteAccountModal";
+import { PamUpdateAccountModal } from "../../PamAccountsPage/components/PamUpdateAccountModal";
+import { PamAddDomainAccountModal } from "./PamAddDomainAccountModal";
+
+type Props = {
+ domain: TPamDomain;
+};
+
+export const PamDomainAccountsSection = ({ domain }: Props) => {
+ const navigate = useNavigate();
+ const { currentOrg } = useOrganization();
+ const params = useParams({ strict: false }) as { projectId?: string };
+ const { projectId } = params;
+
+ const [search, setSearch] = useState("");
+ const [debouncedSearch] = useDebounce(search);
+
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
+ "addAccount",
+ "updateAccount",
+ "deleteAccount"
+ ] as const);
+
+ const [copiedAccountId, setCopiedAccountId] = useToggle(false);
+
+ const handleCopyId = useCallback(
+ (id: string) => {
+ setCopiedAccountId.on();
+ navigator.clipboard.writeText(id);
+ createNotification({ text: "Account ID copied to clipboard", type: "info" });
+ setTimeout(() => setCopiedAccountId.off(), 2000);
+ },
+ [setCopiedAccountId]
+ );
+
+ const { data: accountsData, isPending } = useListPamAccounts({
+ projectId: projectId || "",
+ search: debouncedSearch || undefined,
+ filterDomainIds: domain.id
+ });
+
+ const accounts = accountsData?.accounts || [];
+
+ const handleAccountClick = (accountId: string) => {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ domainType: domain.domainType,
+ domainId: domain.id,
+ accountId
+ }
+ });
+ };
+
+ return (
+ <div className="rounded-lg border border-border bg-container">
+ <div className="flex items-center justify-between border-b border-border px-4 py-3">
+ <div>
+ <h3 className="text-lg font-medium">Domain Accounts</h3>
+ <p className="text-sm text-muted">
+ Accounts associated with this domain that can be used for access
+ </p>
+ </div>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Create}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ {(isAllowed) => (
+ <Button
+ variant="neutral"
+ size="sm"
+ isDisabled={!isAllowed}
+ onClick={() => handlePopUpOpen("addAccount")}
+ >
+ <PlusIcon />
+ Add Account
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ <div className="p-4">
+ <div className="mb-4 flex gap-2">
+ <V2Input
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
+ placeholder="Search accounts..."
+ className="h-full flex-1"
+ containerClassName="h-9"
+ />
+ </div>
+
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead>Account Name</UnstableTableHead>
+ <UnstableTableHead>Type</UnstableTableHead>
+ <UnstableTableHead>Created</UnstableTableHead>
+ <UnstableTableHead className="w-5" />
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {isPending && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={4} className="text-center text-muted">
+ Loading accounts...
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending && accounts.length === 0 && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={4}>
+ <UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>
+ {search ? "No accounts match search" : "No accounts"}
+ </UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending &&
+ accounts.map((account) => {
+ const internalMeta = (account as Record<string, unknown>).internalMetadata as
+ | Record<string, string>
+ | undefined;
+ return (
+ <UnstableTableRow
+ key={account.id}
+ className="group cursor-pointer"
+ onClick={() => handleAccountClick(account.id)}
+ >
+ <UnstableTableCell>
+ <div className="flex items-center gap-3">
+ <span className="font-medium">{account.name}</span>
+ {!account.credentialsConfigured && (
+ <Badge variant="warning" className="text-xs">
+ <KeyRoundIcon className="size-3" />
+ <span>No password</span>
+ </Badge>
+ )}
+ </div>
+ </UnstableTableCell>
+ <UnstableTableCell className="text-muted capitalize">
+ {internalMeta?.accountType || "-"}
+ </UnstableTableCell>
+ <UnstableTableCell className="text-muted">
+ {new Date(account.createdAt).toLocaleDateString()}
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton
+ variant="ghost"
+ size="xs"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <EllipsisVerticalIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent sideOffset={2} align="end">
+ <UnstableDropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation();
+ handleCopyId(account.id);
+ }}
+ >
+ {copiedAccountId ? (
+ <CheckIcon className="size-4" />
+ ) : (
+ <CopyIcon className="size-4" />
+ )}
+ Copy Account ID
+ </UnstableDropdownMenuItem>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Edit}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ {(isAllowed: boolean) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("updateAccount", account);
+ }}
+ >
+ <PencilIcon className="size-4" />
+ Edit Account
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Delete}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ {(isAllowed: boolean) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ variant="danger"
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteAccount", account);
+ }}
+ >
+ <TrashIcon className="size-4" />
+ Delete Account
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ </UnstableTableBody>
+ </UnstableTable>
+ </div>
+
+ <PamAddDomainAccountModal
+ isOpen={popUp.addAccount.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addAccount", isOpen)}
+ projectId={projectId!}
+ domain={domain}
+ />
+
+ <PamUpdateAccountModal
+ isOpen={popUp.updateAccount.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("updateAccount", isOpen)}
+ account={popUp.updateAccount.data as TPamAccount}
+ />
+
+ <PamDeleteAccountModal
+ isOpen={popUp.deleteAccount.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("deleteAccount", isOpen)}
+ account={popUp.deleteAccount.data as TPamAccount}
+ />
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx
new file mode 100644
index 0000000000..cb0d01f961
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainConnectionSection.tsx
@@ -0,0 +1,71 @@
+import { useQuery } from "@tanstack/react-query";
+import { PencilIcon } from "lucide-react";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Detail,
+ DetailGroup,
+ DetailLabel,
+ DetailValue,
+ UnstableIconButton
+} from "@app/components/v3";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
+import { gatewaysQueryKeys } from "@app/hooks/api";
+import { PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
+
+type Props = {
+ domain: TPamDomain;
+ onEdit: VoidFunction;
+};
+
+const ActiveDirectoryConnectionDetails = ({
+ connectionDetails
+}: {
+ connectionDetails: { domain: string; dcAddress: string; port: number };
+}) => (
+ <DetailGroup>
+ <Detail>
+ <DetailLabel>Domain</DetailLabel>
+ <DetailValue>{connectionDetails.domain}</DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>DC Address</DetailLabel>
+ <DetailValue>{connectionDetails.dcAddress}</DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>Port</DetailLabel>
+ <DetailValue>{connectionDetails.port}</DetailValue>
+ </Detail>
+ </DetailGroup>
+);
+
+export const PamDomainConnectionSection = ({ domain, onEdit }: Props) => {
+ const { data: gateways } = useQuery(gatewaysQueryKeys.list());
+ const gateway = gateways?.find((g) => g.id === domain.gatewayId);
+
+ return (
+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
+ <div className="flex items-center justify-between border-b border-border pb-2">
+ <h3 className="text-lg font-medium">Connection</h3>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.PamDomains}>
+ {(isAllowed) => (
+ <UnstableIconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
+ <PencilIcon />
+ </UnstableIconButton>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ <div className="space-y-4">
+ {domain.gatewayId && (
+ <Detail>
+ <DetailLabel>Gateway</DetailLabel>
+ <DetailValue>{gateway?.name ?? "Unknown"}</DetailValue>
+ </Detail>
+ )}
+ {domain.domainType === PamDomainType.ActiveDirectory && (
+ <ActiveDirectoryConnectionDetails connectionDetails={domain.connectionDetails} />
+ )}
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx
new file mode 100644
index 0000000000..8730cd442d
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainDetailsSection.tsx
@@ -0,0 +1,45 @@
+import { format } from "date-fns";
+import { PencilIcon } from "lucide-react";
+
+import { ProjectPermissionCan } from "@app/components/permissions";
+import {
+ Detail,
+ DetailGroup,
+ DetailLabel,
+ DetailValue,
+ UnstableIconButton
+} from "@app/components/v3";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
+import { TPamDomain } from "@app/hooks/api/pamDomain";
+
+type Props = {
+ domain: TPamDomain;
+ onEdit: VoidFunction;
+};
+
+export const PamDomainDetailsSection = ({ domain, onEdit }: Props) => {
+ return (
+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
+ <div className="flex items-center justify-between border-b border-border pb-2">
+ <h3 className="text-lg font-medium">Details</h3>
+ <ProjectPermissionCan I={ProjectPermissionActions.Edit} a={ProjectPermissionSub.PamDomains}>
+ {(isAllowed) => (
+ <UnstableIconButton variant="ghost" size="xs" onClick={onEdit} isDisabled={!isAllowed}>
+ <PencilIcon />
+ </UnstableIconButton>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ <DetailGroup>
+ <Detail>
+ <DetailLabel>Name</DetailLabel>
+ <DetailValue>{domain.name}</DetailValue>
+ </Detail>
+ <Detail>
+ <DetailLabel>Created</DetailLabel>
+ <DetailValue>{format(new Date(domain.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
+ </Detail>
+ </DetailGroup>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx
new file mode 100644
index 0000000000..425dc9f694
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainMetadataSection.tsx
@@ -0,0 +1,149 @@
+import { useCallback, useEffect, useState } from "react";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { PencilIcon } from "lucide-react";
+import { z } from "zod";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { Button, Modal, ModalContent } from "@app/components/v2";
+import { Badge, UnstableButtonGroup, UnstableIconButton } from "@app/components/v3";
+import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
+import { TPamDomain, useUpdatePamDomain } from "@app/hooks/api/pamDomain";
+import { MetadataForm } from "@app/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/MetadataForm";
+
+type Props = {
+ domain: TPamDomain;
+};
+
+const metadataFormSchema = z.object({
+ metadata: z
+ .object({
+ key: z.string().trim().min(1, "Key is required"),
+ value: z.string().trim().default("")
+ })
+ .array()
+});
+
+type MetadataFormData = z.infer<typeof metadataFormSchema>;
+
+export const PamDomainMetadataSection = ({ domain }: Props) => {
+ const metadata = domain.metadata || [];
+ const { mutateAsync: updateDomain } = useUpdatePamDomain();
+ const [isModalOpen, setIsModalOpen] = useState(false);
+
+ const { control, handleSubmit, reset, formState } = useForm<MetadataFormData>({
+ resolver: zodResolver(metadataFormSchema),
+ defaultValues: {
+ metadata: metadata.length > 0 ? metadata : []
+ }
+ });
+
+ useEffect(() => {
+ if (metadata) {
+ reset({ metadata: metadata.length > 0 ? metadata : [] });
+ }
+ }, [metadata, reset]);
+
+ const handleCancel = useCallback(() => {
+ reset({ metadata: metadata.length > 0 ? metadata : [] });
+ setIsModalOpen(false);
+ }, [metadata, reset]);
+
+ const onSubmit = useCallback(
+ async (formData: MetadataFormData) => {
+ try {
+ await updateDomain({
+ domainId: domain.id,
+ domainType: domain.domainType,
+ metadata: formData.metadata || []
+ });
+ createNotification({
+ text: "Domain metadata updated successfully",
+ type: "success"
+ });
+ setIsModalOpen(false);
+ } catch (error) {
+ createNotification({
+ text: `Failed to update metadata: ${(error as Error)?.message || "Unknown error"}`,
+ type: "error"
+ });
+ }
+ },
+ [domain.id, domain.domainType, updateDomain]
+ );
+
+ return (
+ <>
+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">
+ <div className="flex items-center justify-between border-b border-border pb-2">
+ <h3 className="text-lg font-medium">Metadata</h3>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.PamDomains}
+ >
+ {(isAllowed) => (
+ <UnstableIconButton
+ variant="ghost"
+ size="xs"
+ onClick={() => {
+ reset({ metadata: metadata.length > 0 ? metadata : [] });
+ setIsModalOpen(true);
+ }}
+ isDisabled={!isAllowed}
+ >
+ <PencilIcon />
+ </UnstableIconButton>
+ )}
+ </ProjectPermissionCan>
+ </div>
+ {metadata.length > 0 ? (
+ <div className="flex flex-wrap gap-2">
+ {metadata.map((item) =>
+ item.value ? (
+ <UnstableButtonGroup
+ className="max-w-full min-w-0"
+ key={`${item.key}=${item.value}`}
+ >
+ <Badge isTruncatable className="max-w-[12rem] shrink-0">
+ <span>{item.key}</span>
+ </Badge>
+ <Badge variant="outline" isTruncatable>
+ <span>{item.value}</span>
+ </Badge>
+ </UnstableButtonGroup>
+ ) : (
+ <Badge key={item.key} isTruncatable>
+ <span>{item.key}</span>
+ </Badge>
+ )
+ )}
+ </div>
+ ) : (
+ <p className="text-sm text-mineshaft-400">No metadata attached to this domain.</p>
+ )}
+ </div>
+
+ <Modal isOpen={isModalOpen} onOpenChange={setIsModalOpen}>
+ <ModalContent
+ title="Edit Metadata"
+ subTitle="Update metadata key-value pairs for this domain."
+ >
+ <MetadataForm control={control} title="" />
+ <div className="mt-4 flex justify-end gap-2">
+ <Button variant="outline_bg" onClick={handleCancel}>
+ Cancel
+ </Button>
+ <Button
+ onClick={handleSubmit(onSubmit)}
+ isLoading={formState.isSubmitting}
+ isDisabled={formState.isSubmitting}
+ >
+ Save
+ </Button>
+ </div>
+ </ModalContent>
+ </Modal>
+ </>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx
new file mode 100644
index 0000000000..e482bbc6ff
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamDomainRelatedResourcesSection.tsx
@@ -0,0 +1,117 @@
+import { useNavigate, useParams } from "@tanstack/react-router";
+
+import {
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
+ UnstableTable,
+ UnstableTableBody,
+ UnstableTableCell,
+ UnstableTableHead,
+ UnstableTableHeader,
+ UnstableTableRow
+} from "@app/components/v3";
+import { useOrganization } from "@app/context";
+import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
+import {
+ PAM_DOMAIN_TYPE_MAP,
+ TPamDomain,
+ useListDomainRelatedResources
+} from "@app/hooks/api/pamDomain";
+
+type Props = {
+ domain: TPamDomain;
+};
+
+export const PamDomainRelatedResourcesSection = ({ domain }: Props) => {
+ const navigate = useNavigate();
+ const { currentOrg } = useOrganization();
+ const params = useParams({ strict: false }) as { projectId?: string };
+ const { projectId } = params;
+
+ const { data: relatedResources, isPending } = useListDomainRelatedResources(
+ domain.domainType,
+ domain.id
+ );
+
+ const resources = relatedResources || [];
+ const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP];
+
+ return (
+ <div className="rounded-lg border border-border bg-container">
+ <div className="border-b border-border px-4 py-3">
+ <h3 className="text-lg font-medium">Domain Resources</h3>
+ <p className="text-sm text-muted">
+ Resources that belong to this {domainTypeInfo?.name || domain.domainType} domain
+ </p>
+ </div>
+ <div className="p-4">
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead>Resource</UnstableTableHead>
+ <UnstableTableHead>Type</UnstableTableHead>
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {isPending && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={2} className="text-center text-muted">
+ Loading resources...
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending && resources.length === 0 && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={2}>
+ <UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>No domain resources found</UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending &&
+ resources.map((resource) => {
+ const typeInfo = PAM_RESOURCE_TYPE_MAP[resource.resourceType as PamResourceType];
+ return (
+ <UnstableTableRow
+ key={resource.id}
+ className="group cursor-pointer"
+ onClick={() =>
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ resourceType: resource.resourceType,
+ resourceId: resource.id
+ }
+ })
+ }
+ >
+ <UnstableTableCell>
+ <div className="flex items-center gap-3">
+ {typeInfo?.image && (
+ <img
+ alt={typeInfo.name}
+ src={`/images/integrations/${typeInfo.image}`}
+ className="size-5"
+ />
+ )}
+ <span className="font-medium">{resource.name}</span>
+ </div>
+ </UnstableTableCell>
+ <UnstableTableCell className="text-muted">
+ {typeInfo?.name || resource.resourceType}
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ </UnstableTableBody>
+ </UnstableTable>
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx b/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx
new file mode 100644
index 0000000000..40881d91b3
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/PamUpdateDomainModal.tsx
@@ -0,0 +1,34 @@
+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
+import { PAM_DOMAIN_TYPE_MAP, TPamDomain } from "@app/hooks/api/pamDomain";
+
+import { PamDomainForm } from "../../PamDomainsPage/components/PamDomainForm/PamDomainForm";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ domain?: TPamDomain;
+};
+
+export const PamUpdateDomainModal = ({ isOpen, onOpenChange, domain }: Props) => {
+ if (!domain) return null;
+
+ const domainTypeInfo = PAM_DOMAIN_TYPE_MAP[domain.domainType];
+
+ return (
+ <Sheet open={isOpen} onOpenChange={onOpenChange}>
+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
+ <SheetHeader className="border-b">
+ <SheetTitle>Edit Domain</SheetTitle>
+ <SheetDescription>
+ Update details for this {domainTypeInfo?.name} domain.
+ </SheetDescription>
+ </SheetHeader>
+ <PamDomainForm
+ closeSheet={() => onOpenChange(false)}
+ domain={domain}
+ projectId={domain.projectId}
+ />
+ </SheetContent>
+ </Sheet>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts b/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts
new file mode 100644
index 0000000000..ce8e6fbce5
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/components/index.ts
@@ -0,0 +1,6 @@
+export { PamDomainAccountsSection } from "./PamDomainAccountsSection";
+export { PamDomainConnectionSection } from "./PamDomainConnectionSection";
+export { PamDomainDetailsSection } from "./PamDomainDetailsSection";
+export { PamDomainMetadataSection } from "./PamDomainMetadataSection";
+export { PamDomainRelatedResourcesSection } from "./PamDomainRelatedResourcesSection";
+export { PamUpdateDomainModal } from "./PamUpdateDomainModal";
diff --git a/frontend/src/pages/pam/PamDomainByIDPage/route.tsx b/frontend/src/pages/pam/PamDomainByIDPage/route.tsx
new file mode 100644
index 0000000000..9ff8f49e37
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainByIDPage/route.tsx
@@ -0,0 +1,40 @@
+import { createFileRoute, linkOptions } from "@tanstack/react-router";
+import { zodValidator } from "@tanstack/zod-adapter";
+import { z } from "zod";
+
+import { PamDomainByIDPage } from "./PamDomainByIDPage";
+
+enum DomainDetailTab {
+ Accounts = "accounts",
+ RelatedResources = "related-resources"
+}
+
+const domainDetailSearchSchema = z.object({
+ selectedTab: z.nativeEnum(DomainDetailTab).optional().default(DomainDetailTab.Accounts)
+});
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/"
+)({
+ validateSearch: zodValidator(domainDetailSearchSchema),
+ beforeLoad: ({ context, params }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Domains",
+ link: linkOptions({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains",
+ params: { orgId: params.orgId, projectId: params.projectId }
+ })
+ },
+ {
+ label: "Domain Details"
+ }
+ ]
+ };
+ },
+ component: PamDomainByIDPage
+});
+
+export { DomainDetailTab };
diff --git a/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx b/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx
new file mode 100644
index 0000000000..5800d199a4
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/PamDomainsPage.tsx
@@ -0,0 +1,30 @@
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
+
+import { PageHeader } from "@app/components/v2";
+import { ProjectType } from "@app/hooks/api/projects/types";
+
+import { PamDomainsSection } from "./components/PamDomainsSection";
+
+export const PamDomainsPage = () => {
+ const { t } = useTranslation();
+ return (
+ <>
+ <Helmet>
+ <title>{t("common.head-title", { title: "PAM Domains" })}</title>
+ </Helmet>
+ <div className="h-full bg-bunker-800">
+ <div className="mx-auto flex flex-col justify-between bg-bunker-800 text-white">
+ <div className="mx-auto mb-6 w-full max-w-8xl">
+ <PageHeader
+ scope={ProjectType.PAM}
+ title="Domains"
+ description="Manage domains and directory services."
+ />
+ <PamDomainsSection />
+ </div>
+ </div>
+ </div>
+ </>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx b/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx
new file mode 100644
index 0000000000..dcdc9c1700
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/DomainTypeSelect.tsx
@@ -0,0 +1,86 @@
+import { useMemo, useState } from "react";
+import { SearchIcon } from "lucide-react";
+
+import { Button, InputGroup, InputGroupAddon, InputGroupInput, Label } from "@app/components/v3";
+import {
+ PAM_DOMAIN_TYPE_MAP,
+ PamDomainType,
+ useListPamDomainOptions
+} from "@app/hooks/api/pamDomain";
+
+type Props = {
+ onSelect: (domainType: PamDomainType) => void;
+};
+
+export const DomainTypeSelect = ({ onSelect }: Props) => {
+ const { isPending, data: domainOptions } = useListPamDomainOptions();
+ const [search, setSearch] = useState("");
+
+ const allOptions = useMemo(() => {
+ if (!domainOptions) return [];
+ return domainOptions.sort((a, b) => a.name.localeCompare(b.name));
+ }, [domainOptions]);
+
+ const filteredOptions = useMemo(() => {
+ if (!search.trim()) return allOptions;
+ const searchLower = search.toLowerCase();
+ return allOptions.filter((option) => option.name.toLowerCase().includes(searchLower));
+ }, [allOptions, search]);
+
+ if (isPending) {
+ return (
+ <div className="flex h-full items-center justify-center">
+ <Label>Loading options...</Label>
+ </div>
+ );
+ }
+
+ return (
+ <div className="flex flex-col overflow-hidden">
+ <div className="p-4 pb-2">
+ <InputGroup>
+ <InputGroupAddon>
+ <SearchIcon className="size-4" />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder="Search domain types..."
+ />
+ </InputGroup>
+ </div>
+ <div className="flex flex-1 overflow-y-auto">
+ <div className="flex h-fit w-full flex-col gap-2 p-4 pt-2">
+ {filteredOptions.length === 0 ? (
+ <div className="flex items-center justify-center py-8 text-sm text-muted">
+ No domain types found
+ </div>
+ ) : (
+ filteredOptions.map((option) => {
+ const details = PAM_DOMAIN_TYPE_MAP[option.domain as PamDomainType];
+
+ return (
+ <Button
+ key={option.domain}
+ onClick={() => onSelect(option.domain as PamDomainType)}
+ size="lg"
+ variant="neutral"
+ className="w-full justify-start"
+ >
+ {details?.image && (
+ <img
+ src={`/images/integrations/${details.image}`}
+ className="size-6"
+ alt={`${details.name} logo`}
+ />
+ )}
+ <Label className="pointer-events-none">{details?.name || option.name}</Label>
+ </Button>
+ );
+ })
+ )}
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx
new file mode 100644
index 0000000000..5086ecd19c
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamAddDomainModal.tsx
@@ -0,0 +1,74 @@
+import { Dispatch, SetStateAction, useState } from "react";
+
+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@app/components/v3";
+import { PamDomainType, TPamDomain } from "@app/hooks/api/pamDomain";
+
+import { PamDomainForm } from "./PamDomainForm/PamDomainForm";
+import { DomainTypeSelect } from "./DomainTypeSelect";
+
+type Props = {
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ projectId: string;
+ onComplete?: (domain: TPamDomain) => void;
+};
+
+type ContentProps = {
+ closeSheet: (domain?: TPamDomain) => void;
+ projectId: string;
+ selectedDomainType: PamDomainType | null;
+ setSelectedDomainType: Dispatch<SetStateAction<PamDomainType | null>>;
+};
+
+const Content = ({
+ closeSheet,
+ projectId,
+ selectedDomainType,
+ setSelectedDomainType
+}: ContentProps) => {
+ if (selectedDomainType) {
+ return (
+ <PamDomainForm
+ closeSheet={closeSheet}
+ onBack={() => setSelectedDomainType(null)}
+ domainType={selectedDomainType}
+ projectId={projectId}
+ />
+ );
+ }
+
+ return <DomainTypeSelect onSelect={setSelectedDomainType} />;
+};
+
+export const PamAddDomainModal = ({ isOpen, onOpenChange, projectId, onComplete }: Props) => {
+ const [selectedDomainType, setSelectedDomainType] = useState<PamDomainType | null>(null);
+
+ return (
+ <Sheet
+ open={isOpen}
+ onOpenChange={(e) => {
+ onOpenChange(e);
+ setSelectedDomainType(null);
+ }}
+ >
+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 sm:max-w-lg">
+ <SheetHeader className="border-b">
+ <SheetTitle>Create Domain</SheetTitle>
+ <SheetDescription>
+ {selectedDomainType ? "Input domain connection details" : "Select a domain type"}
+ </SheetDescription>
+ </SheetHeader>
+ <Content
+ projectId={projectId}
+ closeSheet={(domain) => {
+ if (domain && onComplete) onComplete(domain);
+ onOpenChange(false);
+ setSelectedDomainType(null);
+ }}
+ selectedDomainType={selectedDomainType}
+ setSelectedDomainType={setSelectedDomainType}
+ />
+ </SheetContent>
+ </Sheet>
+ );
+};
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/ActiveDirectoryResourceForm.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx
similarity index 87%
rename from frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/ActiveDirectoryResourceForm.tsx
rename to frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx
index 47bf877c4b..bedb922734 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/ActiveDirectoryResourceForm.tsx
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/ActiveDirectoryDomainForm.tsx
@@ -18,24 +18,26 @@ import {
TooltipTrigger,
UnstableInput
} from "@app/components/v3";
-import { PamResourceType, TActiveDirectoryResource } from "@app/hooks/api/pam";
+import { TPamDomain } from "@app/hooks/api/pamDomain";
-import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
-import { MetadataFields } from "./MetadataFields";
+import {
+ GenericResourceFields,
+ genericResourceFieldsSchema
+} from "../../../PamResourcesPage/components/PamResourceForm/GenericResourceFields";
+import { MetadataFields } from "../../../PamResourcesPage/components/PamResourceForm/MetadataFields";
type Props = {
- resource?: TActiveDirectoryResource;
+ domain?: TPamDomain;
onSubmit: (formData: FormData) => Promise<void>;
closeSheet: () => void;
};
const formSchema = genericResourceFieldsSchema.extend({
- resourceType: z.literal(PamResourceType.ActiveDirectory),
connectionDetails: z.object({
domain: z.string().trim().min(1, "Domain is required"),
dcAddress: z.string().trim().min(1, "DC address is required"),
port: z.coerce.number().int().min(1).max(65535),
- useLdaps: z.boolean().default(false),
+ useLdaps: z.boolean().default(true),
ldapRejectUnauthorized: z.boolean().default(true),
ldapCaCert: z
.string()
@@ -52,31 +54,30 @@ const formSchema = genericResourceFieldsSchema.extend({
type FormData = z.infer<typeof formSchema>;
-export const ActiveDirectoryResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
- const isUpdate = Boolean(resource);
+export const ActiveDirectoryDomainForm = ({ domain, onSubmit, closeSheet }: Props) => {
+ const isUpdate = Boolean(domain);
const form = useForm<FormData>({
resolver: zodResolver(formSchema),
- defaultValues: resource
+ defaultValues: domain
? {
- ...resource,
- gateway: resource.gatewayId ? { id: resource.gatewayId, name: "" } : undefined,
+ name: domain.name,
+ gateway: domain.gatewayId ? { id: domain.gatewayId, name: "" } : undefined,
connectionDetails: {
- ...resource.connectionDetails,
- useLdaps: resource.connectionDetails.useLdaps ?? false,
- ldapRejectUnauthorized: resource.connectionDetails.ldapRejectUnauthorized ?? true,
- ldapCaCert: resource.connectionDetails.ldapCaCert ?? "",
- ldapTlsServerName: resource.connectionDetails.ldapTlsServerName ?? ""
+ ...domain.connectionDetails,
+ useLdaps: domain.connectionDetails.useLdaps ?? false,
+ ldapRejectUnauthorized: domain.connectionDetails.ldapRejectUnauthorized ?? true,
+ ldapCaCert: domain.connectionDetails.ldapCaCert ?? "",
+ ldapTlsServerName: domain.connectionDetails.ldapTlsServerName ?? ""
}
}
: {
- resourceType: PamResourceType.ActiveDirectory,
gateway: undefined,
connectionDetails: {
domain: "",
dcAddress: "",
- port: 389,
- useLdaps: false,
+ port: 636,
+ useLdaps: true,
ldapRejectUnauthorized: true,
ldapCaCert: "",
ldapTlsServerName: ""
@@ -257,7 +258,7 @@ export const ActiveDirectoryResourceForm = ({ resource, onSubmit, closeSheet }:
variant="neutral"
type="submit"
>
- {isUpdate ? "Update Details" : "Create Resource"}
+ {isUpdate ? "Update Details" : "Create Domain"}
</Button>
<Button onClick={closeSheet} variant="outline" className="mr-auto" type="button">
Cancel
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx
new file mode 100644
index 0000000000..1adfcc0884
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainForm/PamDomainForm.tsx
@@ -0,0 +1,127 @@
+import { createNotification } from "@app/components/notifications";
+import {
+ PAM_DOMAIN_TYPE_MAP,
+ PamDomainType,
+ TPamDomain,
+ useCreatePamDomain,
+ useUpdatePamDomain
+} from "@app/hooks/api/pamDomain";
+
+import { PamDomainHeader } from "../PamDomainHeader";
+import { ActiveDirectoryDomainForm } from "./ActiveDirectoryDomainForm";
+
+type FormProps = {
+ closeSheet: (domain?: TPamDomain) => void;
+} & ({ domain: TPamDomain } | { domainType: PamDomainType });
+
+type CreateFormProps = FormProps & {
+ domainType: PamDomainType;
+ projectId: string;
+};
+
+type UpdateFormProps = FormProps & {
+ domain: TPamDomain;
+};
+
+const CreateForm = ({ domainType, closeSheet, projectId }: CreateFormProps) => {
+ const createPamDomain = useCreatePamDomain();
+ const { name: domainName } = PAM_DOMAIN_TYPE_MAP[domainType];
+
+ const onSubmit = async (
+ formData: Record<string, unknown> & {
+ name: string;
+ gateway?: { id: string; name: string } | null;
+ gatewayId?: string;
+ connectionDetails: unknown;
+ metadata?: { key: string; value: string }[];
+ }
+ ) => {
+ const { gateway, ...rest } = formData;
+ const domain = await createPamDomain.mutateAsync({
+ ...rest,
+ domainType,
+ projectId,
+ gatewayId: gateway?.id ?? rest.gatewayId!,
+ connectionDetails: rest.connectionDetails as TPamDomain["connectionDetails"],
+ metadata: rest.metadata
+ });
+ createNotification({
+ text: `Successfully created ${domainName} domain`,
+ type: "success"
+ });
+ closeSheet(domain);
+ };
+
+ switch (domainType) {
+ case PamDomainType.ActiveDirectory:
+ return (
+ <ActiveDirectoryDomainForm onSubmit={onSubmit as any} closeSheet={closeSheet as any} />
+ );
+ default:
+ throw new Error(`Unhandled domain type: ${domainType}`);
+ }
+};
+
+const UpdateForm = ({ domain, closeSheet }: UpdateFormProps) => {
+ const updatePamDomain = useUpdatePamDomain();
+ const { name: domainName } = PAM_DOMAIN_TYPE_MAP[domain.domainType];
+
+ const onSubmit = async (
+ formData: Record<string, unknown> & {
+ name?: string;
+ gateway?: { id: string; name: string } | null;
+ gatewayId?: string;
+ connectionDetails?: unknown;
+ metadata?: { key: string; value: string }[];
+ }
+ ) => {
+ const { gateway, ...rest } = formData;
+ const updatedDomain = await updatePamDomain.mutateAsync({
+ domainId: domain.id,
+ domainType: domain.domainType,
+ ...rest,
+ gatewayId: gateway?.id ?? rest.gatewayId,
+ connectionDetails: rest.connectionDetails as TPamDomain["connectionDetails"],
+ metadata: rest.metadata
+ });
+ createNotification({
+ text: `Successfully updated ${domainName} domain`,
+ type: "success"
+ });
+ closeSheet(updatedDomain);
+ };
+
+ switch (domain.domainType) {
+ case PamDomainType.ActiveDirectory:
+ return (
+ <ActiveDirectoryDomainForm
+ domain={domain}
+ onSubmit={onSubmit as any}
+ closeSheet={closeSheet as any}
+ />
+ );
+ default:
+ throw new Error(`Unhandled domain type: ${domain.domainType}`);
+ }
+};
+
+type Props = { onBack?: () => void; projectId: string } & Pick<FormProps, "closeSheet"> &
+ (
+ | { domainType: PamDomainType; domain?: undefined }
+ | { domainType?: undefined; domain: TPamDomain }
+ );
+
+export const PamDomainForm = ({ onBack, projectId, ...props }: Props) => {
+ const { domain, domainType } = props;
+
+ return (
+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden">
+ <PamDomainHeader domainType={domainType || domain.domainType} onBack={onBack} />
+ {domain ? (
+ <UpdateForm {...props} domain={domain} />
+ ) : (
+ <CreateForm {...props} domainType={domainType} projectId={projectId} />
+ )}
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx
new file mode 100644
index 0000000000..7d03e6b5e9
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainHeader.tsx
@@ -0,0 +1,35 @@
+import { PencilIcon } from "lucide-react";
+
+import { Button, Label } from "@app/components/v3";
+import { PAM_DOMAIN_TYPE_MAP, PamDomainType } from "@app/hooks/api/pamDomain";
+
+type Props = {
+ domainType: PamDomainType;
+ onBack?: () => void;
+};
+
+export const PamDomainHeader = ({ domainType, onBack }: Props) => {
+ const details = PAM_DOMAIN_TYPE_MAP[domainType];
+
+ return (
+ <div className="flex w-full items-center gap-2.5 border-b border-border p-3">
+ {details?.image && (
+ <img
+ alt={`${details.name} logo`}
+ src={`/images/integrations/${details.image}`}
+ className="size-9"
+ />
+ )}
+ <div className="flex w-full flex-col gap-1">
+ <Label>{details?.name || domainType}</Label>
+ <p className="text-xs text-muted">Domain</p>
+ </div>
+ {onBack && (
+ <Button size="xs" variant="neutral" onClick={onBack}>
+ <PencilIcon />
+ Change
+ </Button>
+ )}
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx
new file mode 100644
index 0000000000..5f39bd013a
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsSection.tsx
@@ -0,0 +1,8 @@
+import { useProject } from "@app/context";
+
+import { PamDomainsTable } from "./PamDomainsTable";
+
+export const PamDomainsSection = () => {
+ const { currentProject } = useProject();
+ return <PamDomainsTable projectId={currentProject.id} />;
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
new file mode 100644
index 0000000000..7a0ba2ce3e
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/components/PamDomainsTable.tsx
@@ -0,0 +1,246 @@
+import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useNavigate } from "@tanstack/react-router";
+import { format } from "date-fns";
+import { EllipsisVerticalIcon, PlusIcon, TrashIcon } from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import { ProjectPermissionCan } from "@app/components/permissions";
+import { DeleteActionModal, Input } from "@app/components/v2";
+import {
+ Button,
+ UnstableDropdownMenu,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
+ UnstableIconButton,
+ UnstablePagination,
+ UnstableTable,
+ UnstableTableBody,
+ UnstableTableCell,
+ UnstableTableHead,
+ UnstableTableHeader,
+ UnstableTableRow
+} from "@app/components/v3";
+import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
+import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";
+import {
+ PAM_DOMAIN_TYPE_MAP,
+ type TPamDomain,
+ useDeletePamDomain,
+ useListPamDomains
+} from "@app/hooks/api/pamDomain";
+
+import { PamAddDomainModal } from "./PamAddDomainModal";
+
+type Props = {
+ projectId: string;
+};
+
+export const PamDomainsTable = ({ projectId }: Props) => {
+ const navigate = useNavigate();
+ const { currentOrg } = useOrganization();
+
+ const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([
+ "addDomain",
+ "deleteDomain"
+ ] as const);
+
+ const { search, debouncedSearch, setSearch, setPage, page, perPage, setPerPage, offset } =
+ usePagination("", { initPerPage: 20 });
+
+ const { data, isPending } = useListPamDomains({
+ projectId,
+ offset,
+ limit: perPage,
+ search: debouncedSearch || undefined
+ });
+
+ const domains = data?.domains || [];
+ const totalCount = data?.totalCount || 0;
+
+ useResetPageHelper({ totalCount, offset, setPage });
+
+ const deleteMutation = useDeletePamDomain();
+
+ const handleDelete = async () => {
+ const domain = popUp.deleteDomain.data as TPamDomain;
+ if (!domain) return;
+ try {
+ await deleteMutation.mutateAsync({
+ domainId: domain.id,
+ domainType: domain.domainType
+ });
+ createNotification({ text: "Domain deleted", type: "success" });
+ handlePopUpClose("deleteDomain");
+ } catch {
+ createNotification({ text: "Failed to delete domain", type: "error" });
+ }
+ };
+
+ return (
+ <div>
+ <div className="flex gap-2">
+ <Input
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
+ placeholder="Search domains..."
+ className="h-full flex-1"
+ containerClassName="h-9"
+ />
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Create}
+ a={ProjectPermissionSub.PamDomains}
+ >
+ {(isAllowed) => (
+ <Button
+ variant="project"
+ onClick={() => handlePopUpOpen("addDomain")}
+ isDisabled={!isAllowed}
+ >
+ <PlusIcon />
+ Add Domain
+ </Button>
+ )}
+ </ProjectPermissionCan>
+ </div>
+
+ <div className="mt-4">
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead>Name</UnstableTableHead>
+ <UnstableTableHead>Type</UnstableTableHead>
+ <UnstableTableHead>Created</UnstableTableHead>
+ <UnstableTableHead className="w-5" />
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {isPending && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={4} className="text-center text-muted">
+ Loading domains...
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending && domains.length === 0 && (
+ <UnstableTableRow>
+ <UnstableTableCell colSpan={4}>
+ <UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>
+ {search ? "No domains match search" : "No domains"}
+ </UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ )}
+ {!isPending &&
+ domains.map((domain) => {
+ const typeInfo =
+ PAM_DOMAIN_TYPE_MAP[domain.domainType as keyof typeof PAM_DOMAIN_TYPE_MAP];
+ return (
+ <UnstableTableRow
+ key={domain.id}
+ className="group cursor-pointer"
+ onClick={() =>
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId",
+ params: {
+ orgId: currentOrg.id,
+ projectId,
+ domainType: domain.domainType,
+ domainId: domain.id
+ }
+ })
+ }
+ >
+ <UnstableTableCell>
+ <div className="flex items-center gap-3">
+ {typeInfo?.image && (
+ <img
+ alt={typeInfo.name}
+ src={`/images/integrations/${typeInfo.image}`}
+ className="size-5"
+ />
+ )}
+ <span className="font-medium">{domain.name}</span>
+ </div>
+ </UnstableTableCell>
+ <UnstableTableCell className="text-muted">
+ {typeInfo?.name || domain.domainType}
+ </UnstableTableCell>
+ <UnstableTableCell className="text-muted">
+ {format(new Date(domain.createdAt), "MMM d, yyyy HH:mm")}
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton
+ variant="ghost"
+ size="xs"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <EllipsisVerticalIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent sideOffset={2} align="end">
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.PamDomains}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ variant="danger"
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteDomain", domain);
+ }}
+ >
+ <TrashIcon className="size-4" />
+ Delete
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ </UnstableTableBody>
+ </UnstableTable>
+ {Boolean(totalCount) && !isPending && (
+ <UnstablePagination
+ count={totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={setPage}
+ onChangePerPage={setPerPage}
+ />
+ )}
+ </div>
+
+ <PamAddDomainModal
+ isOpen={popUp.addDomain.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("addDomain", isOpen)}
+ projectId={projectId}
+ />
+
+ <DeleteActionModal
+ isOpen={popUp.deleteDomain.isOpen}
+ title={`Delete domain "${(popUp.deleteDomain.data as TPamDomain)?.name}"?`}
+ subTitle="This will permanently remove this domain and all associated accounts."
+ onChange={(isOpen) => handlePopUpToggle("deleteDomain", isOpen)}
+ deleteKey="confirm"
+ onDeleteApproved={handleDelete}
+ />
+ </div>
+ );
+};
diff --git a/frontend/src/pages/pam/PamDomainsPage/route.tsx b/frontend/src/pages/pam/PamDomainsPage/route.tsx
new file mode 100644
index 0000000000..86fd067f4f
--- /dev/null
+++ b/frontend/src/pages/pam/PamDomainsPage/route.tsx
@@ -0,0 +1,26 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { zodValidator } from "@tanstack/zod-adapter";
+import { z } from "zod";
+
+import { PamDomainsPage } from "./PamDomainsPage";
+
+export const Route = createFileRoute(
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/"
+)({
+ validateSearch: zodValidator(
+ z.object({
+ search: z.string().optional()
+ })
+ ),
+ beforeLoad: ({ context }) => {
+ return {
+ breadcrumbs: [
+ ...context.breadcrumbs,
+ {
+ label: "Domains"
+ }
+ ]
+ };
+ },
+ component: PamDomainsPage
+});
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
index 5793282c39..cdfd97dac1 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
@@ -34,7 +34,6 @@ import {
PamResourceDependenciesSection,
PamResourceDetailsSection,
PamResourceMetadataSection,
- PamResourceRelatedResourcesSection,
PamResourceRotationPolicySection,
PamRotationPolicyModal
} from "./components";
@@ -218,9 +217,6 @@ const PageContent = () => {
{resource.resourceType === PamResourceType.Windows && (
<Tab value="dependencies">Dependencies</Tab>
)}
- {resource.resourceType === PamResourceType.ActiveDirectory && (
- <Tab value="related-resources">Related Resources</Tab>
- )}
</TabList>
<TabPanel value="accounts">
<PamResourceAccountsSection resource={resource} />
@@ -230,11 +226,6 @@ const PageContent = () => {
<PamResourceDependenciesSection resource={resource} />
</TabPanel>
)}
- {resource.resourceType === PamResourceType.ActiveDirectory && (
- <TabPanel value="related-resources">
- <PamResourceRelatedResourcesSection resource={resource} />
- </TabPanel>
- )}
</Tabs>
</div>
</div>
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 8452da8951..ede826ba21 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -55,13 +55,13 @@ import { ApprovalPolicyType, useCheckPolicyMatch } from "@app/hooks/api/approval
import {
PamAccountRotationStatus,
PamResourceType,
- TActiveDirectoryAccount,
TPamAccount,
TPamResource,
TWindowsAccount,
useListPamAccounts
} from "@app/hooks/api/pam";
import { useManualRotateAccount } from "@app/hooks/api/pam/mutations";
+import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
import {
MetadataFilterEntry,
MetadataFilterSection
@@ -78,19 +78,15 @@ type Props = {
resource: TPamResource;
};
-const hasAccountType = (resourceType: PamResourceType) =>
- resourceType === PamResourceType.Windows || resourceType === PamResourceType.ActiveDirectory;
+const hasAccountType = (resourceType: PamResourceType) => resourceType === PamResourceType.Windows;
const hasAccountsWithDependencies = (resourceType: PamResourceType) =>
- resourceType === PamResourceType.Windows || resourceType === PamResourceType.ActiveDirectory;
+ resourceType === PamResourceType.Windows;
const getAccountType = (account: TPamAccount): string | undefined => {
- if (account.resource.resourceType === PamResourceType.Windows) {
+ if (account.resource?.resourceType === PamResourceType.Windows) {
return (account as TWindowsAccount).internalMetadata?.accountType;
}
- if (account.resource.resourceType === PamResourceType.ActiveDirectory) {
- return (account as TActiveDirectoryAccount).internalMetadata?.accountType;
- }
return undefined;
};
@@ -134,12 +130,19 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
setAppliedMetadataEntries([]);
};
+ const { data: domainData } = useGetPamDomainById(
+ PamDomainType.ActiveDirectory,
+ resource.domainId || undefined,
+ { enabled: !!resource.domainId }
+ );
+
const hasRotatingAccounts = rotatingAccountIds.size > 0;
const { data: accountsData, isPending } = useListPamAccounts(
{
projectId: projectId!,
filterResourceIds: resource.id,
+ filterDomainIds: resource.domainId || undefined,
search: debouncedSearch || undefined,
metadataFilter: appliedMetadataEntries.filter((e) => e.key.trim()).length
? appliedMetadataEntries
@@ -195,16 +198,29 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
);
const handleAccountClick = (account: TPamAccount) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: resource.resourceType,
- resourceId: resource.id,
- accountId: account.id
- }
- });
+ if (account.domainId && account.domain) {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ domainType: account.domain.domainType,
+ domainId: account.domainId,
+ accountId: account.id
+ }
+ });
+ } else {
+ navigate({
+ to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId",
+ params: {
+ orgId: currentOrg.id,
+ projectId: projectId!,
+ resourceType: resource.resourceType,
+ resourceId: resource.id,
+ accountId: account.id
+ }
+ });
+ }
};
const handleRotateAccount = async (accountId: string) => {
@@ -258,7 +274,7 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
return;
}
- if (account.resource.resourceType === PamResourceType.AwsIam) {
+ if (account.resource?.resourceType === PamResourceType.AwsIam) {
accessAwsIam(account);
} else {
handlePopUpOpen("accessAccount", { account });
@@ -439,6 +455,12 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
)}
</Tooltip>
+ {account.resourceId !== resource.id && domainData && (
+ <Badge variant="info" className="text-xs">
+ {domainData.connectionDetails.domain}
+ </Badge>
+ )}
+
{!account.credentialsConfigured && (
<Badge variant="warning" className="text-xs">
<KeyRoundIcon className="size-3" />
@@ -508,29 +530,27 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
</UnstableTableCell>
<UnstableTableCell>
<div className="flex items-center gap-2">
- {/* Temporarily disable accessing Windows Server accounts */}
- {/* Disable accessing Active Directory accounts */}
- {resource.resourceType !== PamResourceType.Windows &&
- resource.resourceType !== PamResourceType.ActiveDirectory && (
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Access}
- a={ProjectPermissionSub.PamAccounts}
+ {/* TODO: Disabled for Windows Server and Active Directory accounts until RDP is implemented */}
+ {resource.resourceType !== PamResourceType.Windows && !account.domainId && (
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Access}
+ a={ProjectPermissionSub.PamAccounts}
+ >
+ <Button
+ variant="ghost"
+ size="xs"
+ onClick={(e) => {
+ e.stopPropagation();
+ accessAccount(account);
+ }}
+ isPending={loadingAccountId === account.id}
+ isDisabled={loadingAccountId === account.id}
>
- <Button
- variant="ghost"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- accessAccount(account);
- }}
- isPending={loadingAccountId === account.id}
- isDisabled={loadingAccountId === account.id}
- >
- <LogInIcon />
- Connect
- </Button>
- </ProjectPermissionCan>
- )}
+ <LogInIcon />
+ Connect
+ </Button>
+ </ProjectPermissionCan>
+ )}
<UnstableDropdownMenu>
<UnstableDropdownMenuTrigger asChild>
<UnstableIconButton variant="ghost" size="xs">
@@ -551,58 +571,62 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
)}
Copy Account ID
</UnstableDropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.TriggerRotation}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <UnstableDropdownMenuItem
- isDisabled={!isAllowed || manualRotate.isPending}
- onClick={(e) => {
- e.stopPropagation();
- handleRotateAccount(account.id);
- }}
+ {!account.domainId && (
+ <>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.TriggerRotation}
+ a={ProjectPermissionSub.PamAccounts}
>
- <RefreshCwIcon className="size-4" />
- Rotate Account
- </UnstableDropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Edit}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <UnstableDropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("updateAccount", account);
- }}
+ {(isAllowed: boolean) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed || manualRotate.isPending}
+ onClick={(e) => {
+ e.stopPropagation();
+ handleRotateAccount(account.id);
+ }}
+ >
+ <RefreshCwIcon className="size-4" />
+ Rotate Account
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Edit}
+ a={ProjectPermissionSub.PamAccounts}
>
- <PencilIcon className="size-4" />
- Edit Account
- </UnstableDropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPamAccountActions.Delete}
- a={ProjectPermissionSub.PamAccounts}
- >
- {(isAllowed: boolean) => (
- <UnstableDropdownMenuItem
- isDisabled={!isAllowed}
- variant="danger"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deleteAccount", account);
- }}
+ {(isAllowed: boolean) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("updateAccount", account);
+ }}
+ >
+ <PencilIcon className="size-4" />
+ Edit Account
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionPamAccountActions.Delete}
+ a={ProjectPermissionSub.PamAccounts}
>
- <TrashIcon className="size-4" />
- Delete Account
- </UnstableDropdownMenuItem>
- )}
- </ProjectPermissionCan>
+ {(isAllowed: boolean) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ variant="danger"
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deleteAccount", account);
+ }}
+ >
+ <TrashIcon className="size-4" />
+ Delete Account
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </>
+ )}
</UnstableDropdownMenuContent>
</UnstableDropdownMenu>
</div>
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx
index d5b69a210a..d1648557d7 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceConnectionSection.tsx
@@ -5,7 +5,7 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import { Detail, DetailLabel, DetailValue, UnstableIconButton } from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { gatewaysQueryKeys } from "@app/hooks/api";
-import { PamResourceType, TPamResource, useGetPamResourceById } from "@app/hooks/api/pam";
+import { PamResourceType, TPamResource } from "@app/hooks/api/pam";
type Props = {
resource: TPamResource;
@@ -152,18 +152,10 @@ const AwsIamConnectionDetails = ({
);
const WindowsConnectionDetails = ({
- connectionDetails,
- adServerResourceId
+ connectionDetails
}: {
connectionDetails: { protocol: string; hostname: string; port: number };
- adServerResourceId?: string | null;
}) => {
- const { data: adResource } = useGetPamResourceById(
- PamResourceType.ActiveDirectory,
- adServerResourceId || undefined,
- { enabled: !!adServerResourceId }
- );
-
return (
<>
<Detail>
@@ -178,37 +170,10 @@ const WindowsConnectionDetails = ({
<DetailLabel>Port</DetailLabel>
<DetailValue>{connectionDetails.port}</DetailValue>
</Detail>
- {adResource && (
- <Detail>
- <DetailLabel>AD Resource</DetailLabel>
- <DetailValue>{adResource.name}</DetailValue>
- </Detail>
- )}
</>
);
};
-const ActiveDirectoryConnectionDetails = ({
- connectionDetails
-}: {
- connectionDetails: { domain: string; dcAddress: string; port: number };
-}) => (
- <>
- <Detail>
- <DetailLabel>Domain</DetailLabel>
- <DetailValue>{connectionDetails.domain}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>DC Address</DetailLabel>
- <DetailValue>{connectionDetails.dcAddress}</DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Port</DetailLabel>
- <DetailValue>{connectionDetails.port}</DetailValue>
- </Detail>
- </>
-);
-
const ConnectionDetailsContent = ({ resource }: Props) => {
switch (resource.resourceType) {
case PamResourceType.Postgres:
@@ -226,14 +191,7 @@ const ConnectionDetailsContent = ({ resource }: Props) => {
case PamResourceType.AwsIam:
return <AwsIamConnectionDetails connectionDetails={resource.connectionDetails} />;
case PamResourceType.Windows:
- return (
- <WindowsConnectionDetails
- connectionDetails={resource.connectionDetails}
- adServerResourceId={resource.adServerResourceId}
- />
- );
- case PamResourceType.ActiveDirectory:
- return <ActiveDirectoryConnectionDetails connectionDetails={resource.connectionDetails} />;
+ return <WindowsConnectionDetails connectionDetails={resource.connectionDetails} />;
default:
return null;
}
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRelatedResourcesSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRelatedResourcesSection.tsx
deleted file mode 100644
index 13d8ea2e21..0000000000
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceRelatedResourcesSection.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import { useNavigate, useParams } from "@tanstack/react-router";
-import { MonitorIcon } from "lucide-react";
-
-import {
- UnstableEmpty,
- UnstableEmptyHeader,
- UnstableEmptyTitle,
- UnstableTable,
- UnstableTableBody,
- UnstableTableCell,
- UnstableTableHead,
- UnstableTableHeader,
- UnstableTableRow
-} from "@app/components/v3";
-import { useOrganization } from "@app/context";
-import { PAM_RESOURCE_TYPE_MAP, TPamResource, useListRelatedResources } from "@app/hooks/api/pam";
-
-type Props = {
- resource: TPamResource;
-};
-
-export const PamResourceRelatedResourcesSection = ({ resource }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const params = useParams({ strict: false }) as { projectId?: string };
- const { projectId } = params;
-
- const { data: relatedResources, isPending } = useListRelatedResources(resource.id);
-
- const handleResourceClick = (relatedResource: TPamResource) => {
- navigate({
- to: "/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId",
- params: {
- orgId: currentOrg.id,
- projectId: projectId!,
- resourceType: relatedResource.resourceType,
- resourceId: relatedResource.id
- }
- });
- };
-
- return (
- <div className="rounded-lg border border-border bg-container">
- <div className="border-b border-border px-4 py-3">
- <h3 className="text-lg font-medium">Related Resources</h3>
- <p className="text-sm text-muted">Resources that belong to this Active Directory domain</p>
- </div>
- <div className="p-4">
- <UnstableTable>
- <UnstableTableHeader>
- <UnstableTableRow>
- <UnstableTableHead>Resource</UnstableTableHead>
- <UnstableTableHead>Type</UnstableTableHead>
- </UnstableTableRow>
- </UnstableTableHeader>
- <UnstableTableBody>
- {isPending && (
- <UnstableTableRow>
- <UnstableTableCell colSpan={2} className="text-center text-muted">
- Loading resources...
- </UnstableTableCell>
- </UnstableTableRow>
- )}
- {!isPending && (!relatedResources || relatedResources.length === 0) && (
- <UnstableTableRow>
- <UnstableTableCell colSpan={2}>
- <UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
- <UnstableEmptyHeader>
- <UnstableEmptyTitle>No related resources found</UnstableEmptyTitle>
- </UnstableEmptyHeader>
- </UnstableEmpty>
- </UnstableTableCell>
- </UnstableTableRow>
- )}
- {relatedResources?.map((relatedResource) => {
- const typeInfo = PAM_RESOURCE_TYPE_MAP[relatedResource.resourceType];
- return (
- <UnstableTableRow
- key={relatedResource.id}
- className="group cursor-pointer"
- onClick={() => handleResourceClick(relatedResource)}
- >
- <UnstableTableCell>
- <div className="flex items-center gap-3">
- <div className="flex h-8 w-8 items-center justify-center rounded bg-foreground/5">
- {typeInfo ? (
- <img
- alt={typeInfo.name}
- src={`/images/integrations/${typeInfo.image}`}
- className="size-4"
- />
- ) : (
- <MonitorIcon className="size-4 text-muted" />
- )}
- </div>
- <span className="font-medium">{relatedResource.name}</span>
- </div>
- </UnstableTableCell>
- <UnstableTableCell>
- <span className="text-sm text-muted">
- {typeInfo?.name ?? relatedResource.resourceType}
- </span>
- </UnstableTableCell>
- </UnstableTableRow>
- );
- })}
- </UnstableTableBody>
- </UnstableTable>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx
index 8516d7f231..ac45c4a825 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamRotationPolicyModal.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
-import { InfoIcon, PlusIcon, TriangleAlertIcon, XIcon } from "lucide-react";
+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
@@ -298,19 +298,6 @@ export const PamRotationPolicyModal = ({ isOpen, onOpenChange, resource }: Props
</SheetDescription>
</SheetHeader>
<div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-4">
- {/* LDAPS warning for AD resources */}
- {resource.resourceType === PamResourceType.ActiveDirectory &&
- !(resource.connectionDetails as { useLdaps?: boolean }).useLdaps && (
- <UnstableAlert variant="info">
- <TriangleAlertIcon />
- <UnstableAlertTitle>LDAPS Required for Rotation</UnstableAlertTitle>
- <UnstableAlertDescription>
- Active Directory requires LDAPS (TLS) to change passwords. Enable LDAPS in the
- resource connection settings before configuring rotation.
- </UnstableAlertDescription>
- </UnstableAlert>
- )}
-
{/* Local account warning for Windows Server resources */}
{resource.resourceType === PamResourceType.Windows && (
<UnstableAlert variant="info">
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts b/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts
index c240ad334e..0abf74ba4a 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/index.ts
@@ -3,6 +3,5 @@ export { PamResourceConnectionSection } from "./PamResourceConnectionSection";
export { PamResourceDependenciesSection } from "./PamResourceDependenciesSection";
export { PamResourceDetailsSection } from "./PamResourceDetailsSection";
export { PamResourceMetadataSection } from "./PamResourceMetadataSection";
-export { PamResourceRelatedResourcesSection } from "./PamResourceRelatedResourcesSection";
export { PamResourceRotationPolicySection } from "./PamResourceRotationPolicySection";
export { PamRotationPolicyModal } from "./PamRotationPolicyModal";
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/route.tsx b/frontend/src/pages/pam/PamResourceByIDPage/route.tsx
index 35b8af2e4b..2b964d9b71 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/route.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/route.tsx
@@ -6,8 +6,7 @@ import { PamResourceByIDPage } from "./PamResourceByIDPage";
export enum ResourceDetailTab {
Accounts = "accounts",
- Dependencies = "dependencies",
- RelatedResources = "related-resources"
+ Dependencies = "dependencies"
}
const ResourceDetailSearchSchema = z.object({
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx
index 81b8534770..f74a3b8c93 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceCard.tsx
@@ -16,6 +16,7 @@ import { Badge, UnstableIconButton } from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
import { useToggle } from "@app/hooks";
import { PAM_RESOURCE_TYPE_MAP, TPamResource } from "@app/hooks/api/pam";
+import { PamDomainType, useGetPamDomainById } from "@app/hooks/api/pamDomain";
type Props = {
resource: TPamResource;
@@ -38,6 +39,12 @@ export const PamResourceCard = ({
const { id, name, resourceType, projectId } = resource;
const { image, name: resourceTypeName } = PAM_RESOURCE_TYPE_MAP[resourceType];
+ const { data: domain } = useGetPamDomainById(
+ PamDomainType.ActiveDirectory,
+ resource.domainId || undefined,
+ { enabled: !!resource.domainId }
+ );
+
const [isIdCopied, setIsIdCopied] = useToggle(false);
const handleCopyId = () => {
@@ -158,9 +165,10 @@ export const PamResourceCard = ({
</DropdownMenu>
</div>
</div>
- <Badge variant="neutral" className="mt-1">
- {resourceTypeName}
- </Badge>
+ <div className="mt-1 flex items-center gap-1.5">
+ <Badge variant="neutral">{resourceTypeName}</Badge>
+ {domain && <Badge variant="info">{domain.connectionDetails.domain}</Badge>}
+ </div>
</div>
</div>
</div>
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx
index efca8f24be..7d84cbe1bb 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/PamResourceForm.tsx
@@ -9,7 +9,6 @@ import {
import { DiscriminativePick } from "@app/types";
import { PamResourceHeader } from "../PamResourceHeader";
-import { ActiveDirectoryResourceForm } from "./ActiveDirectoryResourceForm";
import { AwsIamResourceForm } from "./AwsIamResourceForm";
import { KubernetesResourceForm } from "./KubernetesResourceForm";
import { MongoDBResourceForm } from "./MongoDBResourceForm";
@@ -40,7 +39,7 @@ const CreateForm = ({ resourceType, closeSheet, projectId }: CreateFormProps) =>
const onSubmit = async (
formData: DiscriminativePick<
TPamResource,
- "name" | "resourceType" | "connectionDetails" | "adServerResourceId"
+ "name" | "resourceType" | "connectionDetails" | "domainId"
> & {
gateway?: { id: string; name: string } | null;
gatewayId?: string;
@@ -79,8 +78,6 @@ const CreateForm = ({ resourceType, closeSheet, projectId }: CreateFormProps) =>
return <AwsIamResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
case PamResourceType.Windows:
return <WindowsResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
- case PamResourceType.ActiveDirectory:
- return <ActiveDirectoryResourceForm onSubmit={onSubmit} closeSheet={closeSheet} />;
default:
throw new Error(`Unhandled resource: ${resourceType}`);
}
@@ -93,7 +90,7 @@ const UpdateForm = ({ resource, closeSheet }: UpdateFormProps) => {
const onSubmit = async (
formData: DiscriminativePick<
TPamResource,
- "name" | "resourceType" | "connectionDetails" | "adServerResourceId"
+ "name" | "resourceType" | "connectionDetails" | "domainId"
> & {
gateway?: { id: string; name: string } | null;
gatewayId?: string;
@@ -140,14 +137,6 @@ const UpdateForm = ({ resource, closeSheet }: UpdateFormProps) => {
return (
<WindowsResourceForm resource={resource} onSubmit={onSubmit} closeSheet={closeSheet} />
);
- case PamResourceType.ActiveDirectory:
- return (
- <ActiveDirectoryResourceForm
- resource={resource}
- onSubmit={onSubmit}
- closeSheet={closeSheet}
- />
- );
default:
throw new Error(`Unhandled resource: ${(resource as any).resourceType}`);
}
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx
index f6f1249d2c..0776442693 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/WindowsResourceForm.tsx
@@ -10,11 +10,6 @@ import {
FieldError,
FieldLabel,
Label,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
SheetFooter,
Switch,
TextArea,
@@ -23,8 +18,7 @@ import {
TooltipTrigger,
UnstableInput
} from "@app/components/v3";
-import { useProject } from "@app/context";
-import { PamResourceType, TWindowsResource, useListPamResources } from "@app/hooks/api/pam";
+import { PamResourceType, TWindowsResource } from "@app/hooks/api/pam";
import { WindowsProtocol } from "@app/hooks/api/pam/types/windows-server-resource";
import { GenericResourceFields, genericResourceFieldsSchema } from "./GenericResourceFields";
@@ -56,19 +50,13 @@ const formSchema = genericResourceFieldsSchema.extend({
.transform((val) => val || undefined)
.optional()
}),
- adServerResourceId: z.string().uuid().nullable().optional()
+ domainId: z.string().uuid().nullable().optional()
});
type FormData = z.infer<typeof formSchema>;
export const WindowsResourceForm = ({ resource, onSubmit, closeSheet }: Props) => {
const isUpdate = Boolean(resource);
- const { projectId } = useProject();
-
- const { data: adResources, isPending: isAdResourcesLoading } = useListPamResources({
- projectId,
- filterResourceTypes: PamResourceType.ActiveDirectory
- });
const form = useForm<FormData>({
resolver: zodResolver(formSchema),
@@ -76,7 +64,7 @@ export const WindowsResourceForm = ({ resource, onSubmit, closeSheet }: Props) =
? {
...resource,
gateway: resource.gatewayId ? { id: resource.gatewayId, name: "" } : undefined,
- adServerResourceId: resource.adServerResourceId ?? null,
+ domainId: resource.domainId ?? null,
connectionDetails: {
...(resource.connectionDetails as FormData["connectionDetails"]),
winrmPort: (resource.connectionDetails as any).winrmPort ?? 5986,
@@ -100,7 +88,7 @@ export const WindowsResourceForm = ({ resource, onSubmit, closeSheet }: Props) =
winrmCaCert: "",
winrmTlsServerName: ""
},
- adServerResourceId: null
+ domainId: null
}
});
@@ -124,37 +112,6 @@ export const WindowsResourceForm = ({ resource, onSubmit, closeSheet }: Props) =
>
<div className="flex min-h-0 flex-1 shrink flex-col gap-4 overflow-y-auto p-4 pb-8">
<GenericResourceFields />
- <Controller
- control={control}
- name="adServerResourceId"
- render={({ field: { value, onChange }, fieldState: { error } }) => (
- <Field>
- <FieldLabel>Active Directory Resource</FieldLabel>
- <FieldContent>
- <Select
- value={value || "none"}
- onValueChange={(val) => onChange(val === "none" ? null : val)}
- >
- <SelectTrigger className="w-full">
- <SelectValue placeholder={isAdResourcesLoading ? "Loading..." : "None"} />
- </SelectTrigger>
- <SelectContent position="popper" align="start">
- <SelectItem value="none">None</SelectItem>
- {(adResources?.resources || []).map((adResource) => (
- <SelectItem value={adResource.id} key={adResource.id}>
- {adResource.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <p className="text-xs text-muted">
- Optionally associate this server with an AD domain
- </p>
- <FieldError errors={[error]} />
- </FieldContent>
- </Field>
- )}
- />
{/* RDP Connection */}
<div className="flex items-start gap-2">
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx
index bc459db80c..94b3a98ad1 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceHeader.tsx
@@ -4,7 +4,6 @@ import { Button, DocumentationLinkBadge, Label } from "@app/components/v3";
import { PAM_RESOURCE_TYPE_MAP, PamResourceType } from "@app/hooks/api/pam";
const PAM_RESOURCE_DOCS_MAP: Partial<Record<PamResourceType, string>> = {
- [PamResourceType.ActiveDirectory]: "active-directory#create-the-pam-resource",
[PamResourceType.AwsIam]: "aws-iam#create-the-pam-resource",
[PamResourceType.Kubernetes]: "kubernetes#create-the-pam-resource",
[PamResourceType.MySQL]: "mysql#create-the-pam-resource",
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx
index 5be6bab8a3..739cc99f2f 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourcesTable.tsx
@@ -142,19 +142,13 @@ export const PamResourcesTable = ({ projectId }: Props) => {
setPendingResourceTypes([]);
};
- // TODO: Temporary - hide Active Directory and RDP from resource type filter
- const TEMPORARILY_HIDDEN_RESOURCE_TYPES = new Set([
- PamResourceType.ActiveDirectory,
- PamResourceType.RDP
- ]);
-
- const resourceTypeOptions = Object.entries(PAM_RESOURCE_TYPE_MAP)
- .filter(([type]) => !TEMPORARILY_HIDDEN_RESOURCE_TYPES.has(type as PamResourceType))
- .map(([type, { name, image }]) => ({
+ const resourceTypeOptions = Object.entries(PAM_RESOURCE_TYPE_MAP).map(
+ ([type, { name, image }]) => ({
value: type as PamResourceType,
label: name,
image
- }));
+ })
+ );
const isContentEmpty = !resources.length;
const isSearchEmpty = isContentEmpty && (Boolean(search) || isTableFiltered);
diff --git a/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx b/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx
index fc8ec6d17b..f2d1fef604 100644
--- a/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx
+++ b/frontend/src/pages/pam/PamResourcesPage/components/ResourceTypeSelect.tsx
@@ -22,19 +22,12 @@ const COMING_SOON_RESOURCES = [
{ name: "DynamoDB", resource: PamResourceType.DynamoDB },
{ name: "Snowflake", resource: PamResourceType.Snowflake },
{ name: "Elasticsearch", resource: PamResourceType.Elasticsearch },
- { name: "RDP", resource: PamResourceType.RDP },
{ name: "MCP", resource: PamResourceType.MCP },
{ name: "Web Application", resource: PamResourceType.WebApp }
];
const COMING_SOON_SET = new Set(COMING_SOON_RESOURCES.map((r) => r.resource));
-// TODO: Temporary - hide Active Directory and RDP from resource selection
-const TEMPORARILY_HIDDEN_RESOURCES = new Set([
- PamResourceType.ActiveDirectory,
- PamResourceType.RDP
-]);
-
export const ResourceTypeSelect = ({ onSelect }: Props) => {
const { isPending, data: resourceOptions } = useListPamResourceOptions();
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
@@ -42,9 +35,9 @@ export const ResourceTypeSelect = ({ onSelect }: Props) => {
const allOptions = useMemo(() => {
if (!resourceOptions) return [];
- return [...resourceOptions, ...COMING_SOON_RESOURCES]
- .filter((option) => !TEMPORARILY_HIDDEN_RESOURCES.has(option.resource))
- .sort((a, b) => a.name.localeCompare(b.name));
+ return [...resourceOptions, ...COMING_SOON_RESOURCES].sort((a, b) =>
+ a.name.localeCompare(b.name)
+ );
}, [resourceOptions]);
const filteredOptions = useMemo(() => {
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PamAccountPermissionConditions.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PamAccountPermissionConditions.tsx
index 736ff1a7db..e0c0da1f68 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PamAccountPermissionConditions.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PamAccountPermissionConditions.tsx
@@ -32,12 +32,22 @@ export const PamAccountPermissionConditions = ({ position = 0, isDisabled }: Pro
{
value: "resourceName",
label: "Resource Name",
- description: "PAM resource name"
+ description: "Name of the PAM resource this account belongs to"
},
{
value: "resourceType",
label: "Resource Type",
description: "PAM resource type (e.g. postgres, mysql, ssh)"
+ },
+ {
+ value: "domainName",
+ label: "Domain Name",
+ description: "Name of the PAM domain this account belongs to"
+ },
+ {
+ value: "domainType",
+ label: "Domain Type",
+ description: "PAM domain type (e.g. active-directory)"
}
]}
/>
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index 74f754f064..1fa2e6a625 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -791,6 +791,12 @@ export const projectRoleFormSchema = z.object({
})
.array()
.default([]),
+ [ProjectPermissionSub.PamDomains]: GeneralPolicyActionSchema.extend({
+ inverted: z.boolean().optional(),
+ conditions: ConditionSchema
+ })
+ .array()
+ .default([]),
[ProjectPermissionSub.PamAccounts]: PamAccountPolicyActionSchema.extend({
inverted: z.boolean().optional(),
conditions: ConditionSchema
@@ -863,6 +869,7 @@ type TConditionalFields =
| ProjectPermissionSub.AppConnections
| ProjectPermissionSub.PamAccounts
| ProjectPermissionSub.PamResources
+ | ProjectPermissionSub.PamDomains
| ProjectPermissionSub.McpEndpoints
| ProjectPermissionSub.Member
| ProjectPermissionSub.Groups;
@@ -889,6 +896,7 @@ export const isConditionalSubjects = (
subject === ProjectPermissionSub.AppConnections ||
subject === ProjectPermissionSub.PamAccounts ||
subject === ProjectPermissionSub.PamResources ||
+ subject === ProjectPermissionSub.PamDomains ||
subject === ProjectPermissionSub.McpEndpoints ||
subject === ProjectPermissionSub.Member ||
subject === ProjectPermissionSub.Groups;
@@ -1033,6 +1041,7 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
ProjectPermissionSub.AppConnections,
ProjectPermissionSub.PamFolders,
ProjectPermissionSub.PamResources,
+ ProjectPermissionSub.PamDomains,
ProjectPermissionSub.McpEndpoints,
ProjectPermissionSub.McpServers,
ProjectPermissionSub.McpActivityLogs
@@ -3112,6 +3121,28 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
}
]
},
+ [ProjectPermissionSub.PamDomains]: {
+ title: "Domains",
+ description: "Manage PAM domains such as Active Directory",
+ actions: [
+ { label: "Read", value: ProjectPermissionActions.Read, description: "View PAM domains" },
+ {
+ label: "Create",
+ value: ProjectPermissionActions.Create,
+ description: "Add new domains to PAM"
+ },
+ {
+ label: "Modify",
+ value: ProjectPermissionActions.Edit,
+ description: "Update domain configuration"
+ },
+ {
+ label: "Remove",
+ value: ProjectPermissionActions.Delete,
+ description: "Remove PAM domains"
+ }
+ ]
+ },
[ProjectPermissionSub.PamAccounts]: {
title: "Accounts",
description: "Manage privileged account credentials",
@@ -3370,6 +3401,7 @@ const SecretScanningSubject = (enabled = false) => ({
const PamPermissionSubjects = (enabled = false) => ({
[ProjectPermissionSub.PamFolders]: enabled,
[ProjectPermissionSub.PamResources]: enabled,
+ [ProjectPermissionSub.PamDomains]: enabled,
[ProjectPermissionSub.PamAccounts]: enabled,
[ProjectPermissionSub.PamSessions]: enabled,
[ProjectPermissionSub.PamDiscovery]: enabled
@@ -3891,6 +3923,10 @@ export const RoleTemplates: Record<ProjectType, RoleTemplate[]> = {
subject: ProjectPermissionSub.PamResources,
actions: [ProjectPermissionActions.Read]
},
+ {
+ subject: ProjectPermissionSub.PamDomains,
+ actions: [ProjectPermissionActions.Read]
+ },
{
subject: ProjectPermissionSub.PamAccounts,
actions: [ProjectPermissionPamAccountActions.Read]
@@ -3924,6 +3960,10 @@ export const RoleTemplates: Record<ProjectType, RoleTemplate[]> = {
subject: ProjectPermissionSub.PamResources,
actions: Object.values(ProjectPermissionActions)
},
+ {
+ subject: ProjectPermissionSub.PamDomains,
+ actions: Object.values(ProjectPermissionActions)
+ },
{
subject: ProjectPermissionSub.PamAccounts,
actions: [
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
index 07b858e73a..4847685766 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx
@@ -101,7 +101,10 @@ export const renderConditionalComponents = (
return <PamAccountPermissionConditions isDisabled={isDisabled} />;
}
- if (subject === ProjectPermissionSub.PamResources) {
+ if (
+ subject === ProjectPermissionSub.PamResources ||
+ subject === ProjectPermissionSub.PamDomains
+ ) {
return <PamResourcePermissionConditions isDisabled={isDisabled} />;
}
diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts
index 948a8f6012..5693e29fb5 100644
--- a/frontend/src/routeTree.gen.ts
+++ b/frontend/src/routeTree.gen.ts
@@ -173,6 +173,7 @@ import { Route as secretScanningSecretScanningDataSourcesPageRouteImport } from
import { Route as secretManagerIntegrationsListPageRouteImport } from './pages/secret-manager/IntegrationsListPage/route'
import { Route as pamPamSessionsPageRouteImport } from './pages/pam/PamSessionsPage/route'
import { Route as pamPamResourcesPageRouteImport } from './pages/pam/PamResourcesPage/route'
+import { Route as pamPamDomainsPageRouteImport } from './pages/pam/PamDomainsPage/route'
import { Route as pamPamDiscoveryPageRouteImport } from './pages/pam/PamDiscoveryPage/route'
import { Route as certManagerPkiSubscribersPageRouteImport } from './pages/cert-manager/PkiSubscribersPage/route'
import { Route as certManagerIntegrationsListPageRouteImport } from './pages/cert-manager/IntegrationsListPage/route'
@@ -261,9 +262,11 @@ import { Route as secretManagerIntegrationsAzureKeyVaultOauthCallbackPageRouteIm
import { Route as secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteImport } from './pages/secret-manager/integrations/AzureAppConfigurationOauthCallbackPage/route'
import { Route as secretManagerCommitsPageRouteImport } from './pages/secret-manager/CommitsPage/route'
import { Route as pamPamResourceByIDPageRouteImport } from './pages/pam/PamResourceByIDPage/route'
+import { Route as pamPamDomainByIDPageRouteImport } from './pages/pam/PamDomainByIDPage/route'
import { Route as secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport } from './pages/secret-manager/CommitDetailsPage/components/RollbackPreviewTab/route'
import { Route as secretManagerCommitDetailsPageRouteImport } from './pages/secret-manager/CommitDetailsPage/route'
import { Route as pamPamAccountByIDPageRouteImport } from './pages/pam/PamAccountByIDPage/route'
+import { Route as pamPamDomainAccountByIDPageRouteImport } from './pages/pam/PamDomainAccountByIDPage/route'
// Create Virtual Routes
@@ -346,6 +349,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources',
)()
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport =
+ createFileRoute(
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains',
+ )()
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery',
@@ -378,6 +385,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId',
)()
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport =
+ createFileRoute(
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId',
+ )()
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdImport =
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId',
@@ -386,6 +397,10 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
createFileRoute(
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId',
)()
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport =
+ createFileRoute(
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId',
+ )()
// Create/Update Routes
@@ -1118,6 +1133,15 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
} as any,
)
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport.update(
+ {
+ id: '/domains',
+ path: '/domains',
+ getParentRoute: () => pamLayoutRoute,
+ } as any,
+ )
+
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport.update(
{
@@ -1737,6 +1761,13 @@ const pamPamResourcesPageRouteRoute = pamPamResourcesPageRouteImport.update({
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute,
} as any)
+const pamPamDomainsPageRouteRoute = pamPamDomainsPageRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute,
+} as any)
+
const pamPamDiscoveryPageRouteRoute = pamPamDiscoveryPageRouteImport.update({
id: '/',
path: '/',
@@ -1803,6 +1834,16 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
} as any,
)
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport.update(
+ {
+ id: '/$domainType/$domainId',
+ path: '/$domainType/$domainId',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute,
+ } as any,
+ )
+
const secretScanningSecretScanningDataSourceByIdPageRouteRoute =
secretScanningSecretScanningDataSourceByIdPageRouteImport.update({
id: '/$type/$dataSourceId',
@@ -2475,6 +2516,13 @@ const pamPamResourceByIDPageRouteRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRoute,
} as any)
+const pamPamDomainByIDPageRouteRoute = pamPamDomainByIDPageRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute,
+} as any)
+
const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRoute =
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport.update(
{
@@ -2485,6 +2533,16 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
} as any,
)
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport.update(
+ {
+ id: '/accounts/$accountId',
+ path: '/accounts/$accountId',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute,
+ } as any,
+ )
+
const secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute =
secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport.update({
id: '/restore',
@@ -2510,6 +2568,14 @@ const pamPamAccountByIDPageRouteRoute = pamPamAccountByIDPageRouteImport.update(
} as any,
)
+const pamPamDomainAccountByIDPageRouteRoute =
+ pamPamDomainAccountByIDPageRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () =>
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute,
+ } as any)
+
// Populate the FileRoutesByPath interface
declare module '@tanstack/react-router' {
@@ -3396,6 +3462,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport
parentRoute: typeof pamLayoutImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains'
+ path: '/domains'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains'
+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
+ parentRoute: typeof pamLayoutImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources'
path: '/resources'
@@ -3522,6 +3595,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof pamPamDiscoveryPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/'
+ path: '/'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/'
+ preLoaderRoute: typeof pamPamDomainsPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'
path: '/'
@@ -4341,6 +4421,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof secretScanningSecretScanningDataSourceByIdPageRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretScanningProjectIdSecretScanningLayoutDataSourcesImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId'
+ path: '/$domainType/$domainId'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId'
path: '/$resourceType/$resourceId'
@@ -4355,6 +4442,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdImport
parentRoute: typeof secretManagerLayoutImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/'
+ path: '/'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/'
+ preLoaderRoute: typeof pamPamDomainByIDPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/'
path: '/'
@@ -4474,6 +4568,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId'
+ path: '/accounts/$accountId'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
+ preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId'
path: '/accounts/$accountId'
@@ -4481,6 +4582,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdImport
parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdImport
}
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/': {
+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/'
+ path: '/'
+ fullPath: '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/'
+ preLoaderRoute: typeof pamPamDomainAccountByIDPageRouteImport
+ parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdImport
+ }
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/': {
id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/'
path: '/'
@@ -4812,6 +4920,55 @@ const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectI
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteChildren,
)
+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren {
+ pamPamDomainAccountByIDPageRouteRoute: typeof pamPamDomainAccountByIDPageRouteRoute
+}
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren =
+ {
+ pamPamDomainAccountByIDPageRouteRoute:
+ pamPamDomainAccountByIDPageRouteRoute,
+ }
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute._addFileChildren(
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteChildren,
+ )
+
+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren {
+ pamPamDomainByIDPageRouteRoute: typeof pamPamDomainByIDPageRouteRoute
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
+}
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren =
+ {
+ pamPamDomainByIDPageRouteRoute: pamPamDomainByIDPageRouteRoute,
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRoute:
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren,
+ }
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute._addFileChildren(
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteChildren,
+ )
+
+interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren {
+ pamPamDomainsPageRouteRoute: typeof pamPamDomainsPageRouteRoute
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
+}
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren: AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren =
+ {
+ pamPamDomainsPageRouteRoute: pamPamDomainsPageRouteRoute,
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRoute:
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren,
+ }
+
+const AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren =
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute._addFileChildren(
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteChildren,
+ )
+
interface AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteChildren {
pamPamAccountByIDPageRouteRoute: typeof pamPamAccountByIDPageRouteRoute
}
@@ -4882,6 +5039,7 @@ interface pamLayoutRouteChildren {
projectAccessControlPageRoutePamRoute: typeof projectAccessControlPageRoutePamRoute
projectAuditLogsPageRoutePamRoute: typeof projectAuditLogsPageRoutePamRoute
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
pamApprovalRequestDetailPageRouteRoute: typeof pamApprovalRequestDetailPageRouteRoute
@@ -4898,6 +5056,8 @@ const pamLayoutRouteChildren: pamLayoutRouteChildren = {
projectAuditLogsPageRoutePamRoute: projectAuditLogsPageRoutePamRoute,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren,
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRoute:
+ AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRoute:
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren,
AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRoute:
@@ -5863,6 +6023,7 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/pam/$projectId/access-management': typeof projectAccessControlPageRoutePamRoute
'/organizations/$orgId/projects/pam/$projectId/audit-logs': typeof projectAuditLogsPageRoutePamRoute
'/organizations/$orgId/projects/pam/$projectId/discovery': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
+ '/organizations/$orgId/projects/pam/$projectId/domains': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/resources': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/sessions': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
@@ -5881,6 +6042,7 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/cert-manager/$projectId/integrations/': typeof certManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/discovery/': typeof pamPamDiscoveryPageRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains/': typeof pamPamDomainsPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources/': typeof pamPamResourcesPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions/': typeof pamPamSessionsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
@@ -5998,8 +6160,10 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRouteWithChildren
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/': typeof pamPamDomainByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/': typeof pamPamResourceByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/': typeof secretManagerCommitsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
@@ -6017,7 +6181,9 @@ export interface FileRoutesByFullPath {
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdRouteWithChildren
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/': typeof secretManagerCommitDetailsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/': typeof pamPamDomainAccountByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/': typeof pamPamAccountByIDPageRouteRoute
}
@@ -6137,6 +6303,7 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/cert-manager/$projectId/integrations': typeof certManagerIntegrationsListPageRouteRoute
'/organizations/$orgId/projects/cert-manager/$projectId/subscribers': typeof certManagerPkiSubscribersPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/discovery': typeof pamPamDiscoveryPageRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains': typeof pamPamDomainsPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources': typeof pamPamResourcesPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/sessions': typeof pamPamSessionsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations': typeof secretManagerIntegrationsListPageRouteRoute
@@ -6254,6 +6421,7 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId': typeof pamPamDomainByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId': typeof pamPamResourceByIDPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId': typeof secretManagerCommitsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
@@ -6270,6 +6438,7 @@ export interface FileRoutesByTo {
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/data-explorer': typeof pamPamDataExplorerPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId': typeof secretManagerCommitDetailsPageRouteRoute
'/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
+ '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId': typeof pamPamDomainAccountByIDPageRouteRoute
'/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId': typeof pamPamAccountByIDPageRouteRoute
}
@@ -6401,6 +6570,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management': typeof projectAccessControlPageRoutePamRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs': typeof projectAuditLogsPageRoutePamRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDiscoveryRouteWithChildren
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutSessionsRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/access-management': typeof projectAccessControlPageRouteSecretManagerRoute
@@ -6419,6 +6589,7 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/': typeof certManagerIntegrationsListPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/': typeof pamPamDiscoveryPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/': typeof pamPamDomainsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/': typeof pamPamResourcesPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/': typeof pamPamSessionsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/': typeof secretManagerIntegrationsListPageRouteRoute
@@ -6536,8 +6707,10 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/authorize': typeof secretManagerIntegrationsWindmillAuthorizePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/create': typeof secretManagerIntegrationsWindmillConfigurePageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/$type/$dataSourceId': typeof secretScanningSecretScanningDataSourceByIdPageRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdRouteWithChildren
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/': typeof pamPamDomainByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/': typeof pamPamResourceByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/': typeof secretManagerCommitsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-app-configuration/oauth2/callback': typeof secretManagerIntegrationsAzureAppConfigurationOauthCallbackPageRouteRoute
@@ -6555,7 +6728,9 @@ export interface FileRoutesById {
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsSecretManagementProjectIdSecretManagerLayoutCommitsEnvironmentFolderIdCommitIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/': typeof secretManagerCommitDetailsPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/restore': typeof secretManagerCommitDetailsPageComponentsRollbackPreviewTabRouteRoute
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutDomainsDomainTypeDomainIdAccountsAccountIdRouteWithChildren
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdProjectsPamProjectIdPamLayoutResourcesResourceTypeResourceIdAccountsAccountIdRouteWithChildren
+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/': typeof pamPamDomainAccountByIDPageRouteRoute
'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/': typeof pamPamAccountByIDPageRouteRoute
}
@@ -6676,6 +6851,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/pam/$projectId/access-management'
| '/organizations/$orgId/projects/pam/$projectId/audit-logs'
| '/organizations/$orgId/projects/pam/$projectId/discovery'
+ | '/organizations/$orgId/projects/pam/$projectId/domains'
| '/organizations/$orgId/projects/pam/$projectId/resources'
| '/organizations/$orgId/projects/pam/$projectId/sessions'
| '/organizations/$orgId/projects/secret-management/$projectId/access-management'
@@ -6694,6 +6870,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations/'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers/'
| '/organizations/$orgId/projects/pam/$projectId/discovery/'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/'
| '/organizations/$orgId/projects/pam/$projectId/resources/'
| '/organizations/$orgId/projects/pam/$projectId/sessions/'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/'
@@ -6811,8 +6988,10 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback'
@@ -6830,7 +7009,9 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId/'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/'
fileRoutesByTo: FileRoutesByTo
to:
@@ -6949,6 +7130,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/cert-manager/$projectId/integrations'
| '/organizations/$orgId/projects/cert-manager/$projectId/subscribers'
| '/organizations/$orgId/projects/pam/$projectId/discovery'
+ | '/organizations/$orgId/projects/pam/$projectId/domains'
| '/organizations/$orgId/projects/pam/$projectId/resources'
| '/organizations/$orgId/projects/pam/$projectId/sessions'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations'
@@ -7066,6 +7248,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/authorize'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/windmill/create'
| '/organizations/$orgId/projects/secret-scanning/$projectId/data-sources/$type/$dataSourceId'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId'
| '/organizations/$orgId/projects/secret-management/$projectId/integrations/azure-app-configuration/oauth2/callback'
@@ -7082,6 +7265,7 @@ export interface FileRouteTypes {
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId/data-explorer'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId'
| '/organizations/$orgId/projects/secret-management/$projectId/commits/$environment/$folderId/$commitId/restore'
+ | '/organizations/$orgId/projects/pam/$projectId/domains/$domainType/$domainId/accounts/$accountId'
| '/organizations/$orgId/projects/pam/$projectId/resources/$resourceType/$resourceId/accounts/$accountId'
id:
| '__root__'
@@ -7211,6 +7395,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/access-management'
@@ -7229,6 +7414,7 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/integrations/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/subscribers/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/'
@@ -7346,8 +7532,10 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/authorize'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/windmill/create'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources/$type/$dataSourceId'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/integrations/azure-app-configuration/oauth2/callback'
@@ -7365,7 +7553,9 @@ export interface FileRouteTypes {
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId/restore'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId'
+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/'
| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/'
fileRoutesById: FileRoutesById
}
@@ -7928,6 +8118,7 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/access-management",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/audit-logs",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/sessions",
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/approval-requests/$approvalRequestId",
@@ -8168,6 +8359,14 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery/$discoveryType/$discoverySourceId"
]
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains": {
+ "filePath": "",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
+ "children": [
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId"
+ ]
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout",
@@ -8332,6 +8531,10 @@ export const routeTree = rootRoute
"filePath": "pam/PamDiscoveryPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/discovery"
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/": {
+ "filePath": "pam/PamDomainsPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains"
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/": {
"filePath": "pam/PamResourcesPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources"
@@ -8800,6 +9003,14 @@ export const routeTree = rootRoute
"filePath": "secret-scanning/SecretScanningDataSourceByIdPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-scanning/$projectId/_secret-scanning-layout/data-sources"
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId": {
+ "filePath": "",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains",
+ "children": [
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/",
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId"
+ ]
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources",
@@ -8816,6 +9027,10 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId"
]
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/": {
+ "filePath": "pam/PamDomainByIDPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId"
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/": {
"filePath": "pam/PamResourceByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId"
@@ -8888,6 +9103,13 @@ export const routeTree = rootRoute
"filePath": "secret-manager/CommitDetailsPage/components/RollbackPreviewTab/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/secret-management/$projectId/_secret-manager-layout/commits/$environment/$folderId/$commitId"
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId": {
+ "filePath": "",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId",
+ "children": [
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/"
+ ]
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId": {
"filePath": "",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId",
@@ -8895,6 +9117,10 @@ export const routeTree = rootRoute
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/"
]
},
+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId/": {
+ "filePath": "pam/PamDomainAccountByIDPage/route.tsx",
+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/domains/$domainType/$domainId/accounts/$accountId"
+ },
"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId/": {
"filePath": "pam/PamAccountByIDPage/route.tsx",
"parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/pam/$projectId/_pam-layout/resources/$resourceType/$resourceId/accounts/$accountId"
diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts
index 9ef979376e..30e4a934bd 100644
--- a/frontend/src/routes.ts
+++ b/frontend/src/routes.ts
@@ -391,6 +391,13 @@ const pamRoutes = route("/organizations/$orgId/projects/pam/$projectId", [
route("/accounts/$accountId", [index("pam/PamAccountByIDPage/route.tsx")])
])
]),
+ route("/domains", [
+ index("pam/PamDomainsPage/route.tsx"),
+ route("/$domainType/$domainId", [
+ index("pam/PamDomainByIDPage/route.tsx"),
+ route("/accounts/$accountId", [index("pam/PamDomainAccountByIDPage/route.tsx")])
+ ])
+ ]),
route("/discovery", [
index("pam/PamDiscoveryPage/route.tsx"),
route("/$discoveryType/$discoverySourceId", "pam/PamDiscoveryDetailPage/route.tsx")