Skip to content

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

Fix merge conflicts

Tuan Dang82bafd02bb89
diff --cc backend/src/@types/fastify.d.ts
index 923f7cc4bb,da966218f4..278aa7401e
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@@ -30,7 -32,7 +32,8 @@@ import { TAuthTokenServiceFactory } fro
import { TGroupProjectServiceFactory } from "@app/services/group-project/group-project-service";
import { TIdentityServiceFactory } from "@app/services/identity/identity-service";
import { TIdentityAccessTokenServiceFactory } from "@app/services/identity-access-token/identity-access-token-service";
+ import { TIdentityAwsIamAuthServiceFactory } from "@app/services/identity-aws-iam-auth/identity-aws-iam-auth-service";
+import { TIdentityGcpIamAuthServiceFactory } from "@app/services/identity-gcp-iam-auth/identity-gcp-iam-auth-service";
import { TIdentityProjectServiceFactory } from "@app/services/identity-project/identity-project-service";
import { TIdentityUaServiceFactory } from "@app/services/identity-ua/identity-ua-service";
import { TIntegrationServiceFactory } from "@app/services/integration/integration-service";
@@@ -114,7 -116,9 +117,10 @@@ declare module "fastify"
identityAccessToken: TIdentityAccessTokenServiceFactory;
identityProject: TIdentityProjectServiceFactory;
identityUa: TIdentityUaServiceFactory;
+ identityGcpIamAuth: TIdentityGcpIamAuthServiceFactory;
+ identityAwsIamAuth: TIdentityAwsIamAuthServiceFactory;
+ accessApprovalPolicy: TAccessApprovalPolicyServiceFactory;
+ accessApprovalRequest: TAccessApprovalRequestServiceFactory;
secretApprovalPolicy: TSecretApprovalPolicyServiceFactory;
secretApprovalRequest: TSecretApprovalRequestServiceFactory;
secretRotation: TSecretRotationServiceFactory;
diff --cc backend/src/@types/knex.d.ts
index acf4934aa6,b597bd2503..7d1df5003e
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@@ -47,9 -59,9 +59,12 @@@ import
TIdentityAccessTokens,
TIdentityAccessTokensInsert,
TIdentityAccessTokensUpdate,
+ TIdentityAwsIamAuths,
+ TIdentityAwsIamAuthsInsert,
+ TIdentityAwsIamAuthsUpdate,
+ TIdentityGcpIamAuths,
+ TIdentityGcpIamAuthsInsert,
+ TIdentityGcpIamAuthsUpdate,
TIdentityOrgMemberships,
TIdentityOrgMembershipsInsert,
TIdentityOrgMembershipsUpdate,
@@@ -317,11 -329,11 +332,16 @@@ declare module "knex/types/tables"
TIdentityUniversalAuthsInsert,
TIdentityUniversalAuthsUpdate
>;
+ [TableName.IdentityGcpIamAuth]: Knex.CompositeTableType<
+ TIdentityGcpIamAuths,
+ TIdentityGcpIamAuthsInsert,
+ TIdentityGcpIamAuthsUpdate
+ >;
+ [TableName.IdentityAwsIamAuth]: Knex.CompositeTableType<
+ TIdentityAwsIamAuths,
+ TIdentityAwsIamAuthsInsert,
+ TIdentityAwsIamAuthsUpdate
+ >;
[TableName.IdentityUaClientSecret]: Knex.CompositeTableType<
TIdentityUaClientSecrets,
TIdentityUaClientSecretsInsert,
diff --cc backend/src/db/schemas/index.ts
index 7a365b18c0,e5c9a9ceb4..0b8f1c22e4
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@@ -13,7 -17,7 +17,8 @@@ export * from "./group-project-membersh
export * from "./groups";
export * from "./identities";
export * from "./identity-access-tokens";
+ export * from "./identity-aws-iam-auths";
+export * from "./identity-gcp-iam-auths";
export * from "./identity-org-memberships";
export * from "./identity-project-additional-privilege";
export * from "./identity-project-membership-role";
diff --cc backend/src/db/schemas/models.ts
index b1006f51dc,4c080535dd..2a4c2d9e6a
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@@ -44,8 -44,8 +44,9 @@@ export enum TableName
Identity = "identities",
IdentityAccessToken = "identity_access_tokens",
IdentityUniversalAuth = "identity_universal_auths",
+ IdentityGcpIamAuth = "identity_gcp_iam_auths",
IdentityUaClientSecret = "identity_ua_client_secrets",
+ IdentityAwsIamAuth = "identity_aws_iam_auths",
IdentityOrgMembership = "identity_org_memberships",
IdentityProjectMembership = "identity_project_memberships",
IdentityProjectMembershipRole = "identity_project_membership_role",
@@@ -140,5 -144,5 +145,6 @@@ export enum ProjectUpgradeStatus
export enum IdentityAuthMethod {
Univeral = "universal-auth",
- GCP_IAM_AUTH = "gcp-iam-auth"
++ GCP_IAM_AUTH = "gcp-iam-auth",
+ AWS_IAM_AUTH = "aws-iam-auth"
}
diff --cc backend/src/ee/services/audit-log/audit-log-types.ts
index 196eab9ef7,1e79984e48..aba6e73290
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@@ -66,10 -66,10 +66,14 @@@ export enum EventType
CREATE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "create-identity-universal-auth-client-secret",
REVOKE_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRET = "revoke-identity-universal-auth-client-secret",
GET_IDENTITY_UNIVERSAL_AUTH_CLIENT_SECRETS = "get-identity-universal-auth-client-secret",
+ LOGIN_IDENTITY_GCP_IAM_AUTH = "login-identity-gcp-iam-auth",
+ ADD_IDENTITY_GCP_IAM_AUTH = "add-identity-gcp-iam -auth",
+ UPDATE_IDENTITY_GCP_IAM_AUTH = "update-identity-gcp-iam-auth",
+ GET_IDENTITY_GCP_IAM_AUTH = "get-identity-gcp-iam-auth",
+ LOGIN_IDENTITY_AWS_IAM_AUTH = "login-identity-aws-iam-auth",
+ ADD_IDENTITY_AWS_IAM_AUTH = "add-identity-aws-iam-auth",
+ UPDATE_IDENTITY_AWS_IAM_AUTH = "update-identity-aws-iam-auth",
+ GET_IDENTITY_AWS_IAM_AUTH = "get-identity-aws-iam-auth",
CREATE_ENVIRONMENT = "create-environment",
UPDATE_ENVIRONMENT = "update-environment",
DELETE_ENVIRONMENT = "delete-environment",
@@@ -410,48 -410,50 +414,92 @@@ interface RevokeIdentityUniversalAuthCl
};
}
+interface LoginIdentityGcpIamAuthEvent {
+ type: EventType.LOGIN_IDENTITY_GCP_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ identityGcpIamAuthId: string;
+ identityAccessTokenId: string;
+ };
+}
+
+interface AddIdentityGcpIamAuthEvent {
+ type: EventType.ADD_IDENTITY_GCP_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface UpdateIdentityGcpIamAuthEvent {
+ type: EventType.UPDATE_IDENTITY_GCP_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ allowedServiceAccounts?: string;
+ allowedProjects?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface GetIdentityGcpIamAuthEvent {
+ type: EventType.GET_IDENTITY_GCP_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
+ interface LoginIdentityAwsIamAuthEvent {
+ type: EventType.LOGIN_IDENTITY_AWS_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ identityAwsIamAuthId: string;
+ identityAccessTokenId: string;
+ };
+ }
+
+ interface AddIdentityAwsIamAuthEvent {
+ type: EventType.ADD_IDENTITY_AWS_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ stsEndpoint: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: Array<TIdentityTrustedIp>;
+ };
+ }
+
+ interface UpdateIdentityAwsIamAuthEvent {
+ type: EventType.UPDATE_IDENTITY_AWS_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ stsEndpoint?: string;
+ allowedPrincipalArns?: string;
+ allowedAccountIds?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ };
+ }
+
+ interface GetIdentityAwsIamAuthEvent {
+ type: EventType.GET_IDENTITY_AWS_IAM_AUTH;
+ metadata: {
+ identityId: string;
+ };
+ }
+
interface CreateEnvironmentEvent {
type: EventType.CREATE_ENVIRONMENT;
metadata: {
@@@ -706,10 -708,10 +754,14 @@@ export type Event
| CreateIdentityUniversalAuthClientSecretEvent
| GetIdentityUniversalAuthClientSecretsEvent
| RevokeIdentityUniversalAuthClientSecretEvent
+ | LoginIdentityGcpIamAuthEvent
+ | AddIdentityGcpIamAuthEvent
+ | UpdateIdentityGcpIamAuthEvent
+ | GetIdentityGcpIamAuthEvent
+ | LoginIdentityAwsIamAuthEvent
+ | AddIdentityAwsIamAuthEvent
+ | UpdateIdentityAwsIamAuthEvent
+ | GetIdentityAwsIamAuthEvent
| CreateEnvironmentEvent
| UpdateEnvironmentEvent
| DeleteEnvironmentEvent
diff --cc backend/src/server/routes/index.ts
index c64d221299,62dad3cf4a..e2dc116065
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@@ -72,8 -78,8 +78,10 @@@ import { identityOrgDALFactory } from "
import { identityServiceFactory } from "@app/services/identity/identity-service";
import { identityAccessTokenDALFactory } from "@app/services/identity-access-token/identity-access-token-dal";
import { identityAccessTokenServiceFactory } from "@app/services/identity-access-token/identity-access-token-service";
+ import { identityAwsIamAuthDALFactory } from "@app/services/identity-aws-iam-auth/identity-aws-iam-auth-dal";
+ import { identityAwsIamAuthServiceFactory } from "@app/services/identity-aws-iam-auth/identity-aws-iam-auth-service";
+import { identityGcpIamAuthDALFactory } from "@app/services/identity-gcp-iam-auth/identity-gcp-iam-auth-dal";
+import { identityGcpIamAuthServiceFactory } from "@app/services/identity-gcp-iam-auth/identity-gcp-iam-auth-service";
import { identityProjectDALFactory } from "@app/services/identity-project/identity-project-dal";
import { identityProjectMembershipRoleDALFactory } from "@app/services/identity-project/identity-project-membership-role-dal";
import { identityProjectServiceFactory } from "@app/services/identity-project/identity-project-service";
@@@ -197,9 -203,8 +205,10 @@@ export const registerRoutes = async
const identityUaDAL = identityUaDALFactory(db);
const identityUaClientSecretDAL = identityUaClientSecretDALFactory(db);
+ const identityAwsIamAuthDAL = identityAwsIamAuthDALFactory(db);
+ const identityGcpIamAuthDAL = identityGcpIamAuthDALFactory(db);
+
const auditLogDAL = auditLogDALFactory(db);
const auditLogStreamDAL = auditLogStreamDALFactory(db);
const trustedIpDAL = trustedIpDALFactory(db);
@@@ -666,15 -702,15 +706,24 @@@
identityUaDAL,
licenseService
});
+ const identityGcpIamAuthService = identityGcpIamAuthServiceFactory({
+ identityGcpIamAuthDAL,
+ identityOrgMembershipDAL,
+ identityAccessTokenDAL,
+ identityDAL,
+ permissionService,
+ licenseService
+ });
+
+ const identityAWSIAMAuthService = identityAwsIamAuthServiceFactory({
+ identityAccessTokenDAL,
+ identityAwsIamAuthDAL,
+ identityOrgMembershipDAL,
+ identityDAL,
+ licenseService,
+ permissionService
+ });
+
const dynamicSecretProviders = buildDynamicSecretProviders();
const dynamicSecretQueueService = dynamicSecretLeaseQueueServiceFactory({
queueService,
@@@ -743,8 -779,10 +792,11 @@@
identityAccessToken: identityAccessTokenService,
identityProject: identityProjectService,
identityUa: identityUaService,
+ identityGcpIamAuth: identityGcpIamAuthService,
+ identityAwsIamAuth: identityAWSIAMAuthService,
secretApprovalPolicy: sapService,
+ accessApprovalPolicy: accessApprovalPolicyService,
+ accessApprovalRequest: accessApprovalRequestService,
secretApprovalRequest: sarService,
secretRotation: secretRotationService,
dynamicSecret: dynamicSecretService,
diff --cc backend/src/server/routes/v1/index.ts
index 3d0ac6b1e7,4fbaabdfce..74bad1bdd0
--- a/backend/src/server/routes/v1/index.ts
+++ b/backend/src/server/routes/v1/index.ts
@@@ -2,7 -2,7 +2,8 @@@ import { registerAdminRouter } from "./
import { registerAuthRoutes } from "./auth-router";
import { registerProjectBotRouter } from "./bot-router";
import { registerIdentityAccessTokenRouter } from "./identity-access-token-router";
+ import { registerIdentityAwsIamAuthRouter } from "./identity-aws-iam-auth-router";
+import { registerIdentityGcpIamAuthRouter } from "./identity-gcp-iam-auth-router";
import { registerIdentityRouter } from "./identity-router";
import { registerIdentityUaRouter } from "./identity-ua";
import { registerIntegrationAuthRouter } from "./integration-auth-router";
@@@ -28,8 -28,8 +29,9 @@@ export const registerV1Routes = async (
async (authRouter) => {
await authRouter.register(registerAuthRoutes);
await authRouter.register(registerIdentityUaRouter);
- await authRouter.register(registerIdentityAccessTokenRouter);
+ await authRouter.register(registerIdentityGcpIamAuthRouter);
+ await authRouter.register(registerIdentityAwsIamAuthRouter);
+ await authRouter.register(registerIdentityAccessTokenRouter);
},
{ prefix: "/auth" }
);
diff --cc docs/mint.json
index 1708f49f38,71fe02a1f3..976d5df37d
--- a/docs/mint.json
+++ b/docs/mint.json
@@@ -153,7 -153,7 +153,8 @@@
"documentation/platform/auth-methods/email-password",
"documentation/platform/token",
"documentation/platform/identities/universal-auth",
+ "documentation/platform/identities/aws-iam-auth",
+ "documentation/platform/identities/gcp-iam-auth",
"documentation/platform/mfa",
{
"group": "SSO",
diff --cc frontend/src/hooks/api/identities/constants.tsx
index ff29df376d,5e8ae069f6..a97b83861a
--- a/frontend/src/hooks/api/identities/constants.tsx
+++ b/frontend/src/hooks/api/identities/constants.tsx
@@@ -2,5 -2,5 +2,6 @@@ import { IdentityAuthMethod } from "./e
export const identityAuthToNameMap: { [I in IdentityAuthMethod]: string } = {
[IdentityAuthMethod.UNIVERSAL_AUTH]: "Universal Auth",
- [IdentityAuthMethod.GCP_IAM_AUTH]: "GCP IAM Auth"
++ [IdentityAuthMethod.GCP_IAM_AUTH]: "GCP IAM Auth",
+ [IdentityAuthMethod.AWS_IAM_AUTH]: "AWS IAM Auth"
};
diff --cc frontend/src/hooks/api/identities/enums.tsx
index 7991ed7db0,614549da32..ecc8f12150
--- a/frontend/src/hooks/api/identities/enums.tsx
+++ b/frontend/src/hooks/api/identities/enums.tsx
@@@ -1,4 -1,4 +1,5 @@@
export enum IdentityAuthMethod {
UNIVERSAL_AUTH = "universal-auth",
- GCP_IAM_AUTH = "gcp-iam-auth"
++ GCP_IAM_AUTH = "gcp-iam-auth",
+ AWS_IAM_AUTH = "aws-iam-auth"
}
diff --cc frontend/src/hooks/api/identities/index.tsx
index dba67af404,16fc567821..21166816ff
--- a/frontend/src/hooks/api/identities/index.tsx
+++ b/frontend/src/hooks/api/identities/index.tsx
@@@ -1,16 -1,16 +1,21 @@@
export { identityAuthToNameMap } from "./constants";
export { IdentityAuthMethod } from "./enums";
export {
+ useAddIdentityAwsIamAuth,
+ useAddIdentityGcpIamAuth,
useAddIdentityUniversalAuth,
useCreateIdentity,
useCreateIdentityUniversalAuthClientSecret,
useDeleteIdentity,
useRevokeIdentityUniversalAuthClientSecret,
useUpdateIdentity,
+ useUpdateIdentityAwsIamAuth,
- useUpdateIdentityUniversalAuth} from "./mutations";
+ useUpdateIdentityGcpIamAuth,
- useUpdateIdentityUniversalAuth} from "./mutations";
++ useUpdateIdentityUniversalAuth
++} from "./mutations";
export {
+ useGetIdentityAwsIamAuth,
+ useGetIdentityGcpIamAuth,
useGetIdentityUniversalAuth,
-- useGetIdentityUniversalAuthClientSecrets} from "./queries";
++ useGetIdentityUniversalAuthClientSecrets
++} from "./queries";
diff --cc frontend/src/hooks/api/identities/mutations.tsx
index 2f573f8d7e,fa956af137..914264b870
--- a/frontend/src/hooks/api/identities/mutations.tsx
+++ b/frontend/src/hooks/api/identities/mutations.tsx
@@@ -5,7 -5,7 +5,8 @@@ import { apiRequest } from "@app/config
import { organizationKeys } from "../organization/queries";
import { identitiesKeys } from "./queries";
import {
+ AddIdentityAwsIamAuthDTO,
+ AddIdentityGcpIamAuthDTO,
AddIdentityUniversalAuthDTO,
ClientSecretData,
CreateIdentityDTO,
@@@ -14,11 -14,11 +15,14 @@@
DeleteIdentityDTO,
DeleteIdentityUniversalAuthClientSecretDTO,
Identity,
+ IdentityAwsIamAuth,
+ IdentityGcpIamAuth,
IdentityUniversalAuth,
+ UpdateIdentityAwsIamAuthDTO,
UpdateIdentityDTO,
- UpdateIdentityUniversalAuthDTO} from "./types";
+ UpdateIdentityGcpIamAuthDTO,
- UpdateIdentityUniversalAuthDTO} from "./types";
++ UpdateIdentityUniversalAuthDTO
++} from "./types";
export const useCreateIdentity = () => {
const queryClient = useQueryClient();
@@@ -172,69 -172,73 +176,142 @@@ export const useRevokeIdentityUniversal
});
};
+export const useAddIdentityGcpIamAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityGcpIamAuth, {}, AddIdentityGcpIamAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ allowedServiceAccounts,
+ allowedProjects,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityGcpIamAuth }
+ } = await apiRequest.post<{ identityGcpIamAuth: IdentityGcpIamAuth }>(
+ `/api/v1/auth/gcp-iam-auth/identities/${identityId}`,
+ {
+ allowedServiceAccounts,
+ allowedProjects,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityGcpIamAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+};
+
+ export const useAddIdentityAwsIamAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityAwsIamAuth, {}, AddIdentityAwsIamAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ stsEndpoint,
+ allowedPrincipalArns,
+ allowedAccountIds,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityAwsIamAuth }
+ } = await apiRequest.post<{ identityAwsIamAuth: IdentityAwsIamAuth }>(
+ `/api/v1/auth/aws-iam-auth/identities/${identityId}`,
+ {
+ stsEndpoint,
+ allowedPrincipalArns,
+ allowedAccountIds,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityAwsIamAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+ };
+
+export const useUpdateIdentityGcpIamAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityGcpIamAuth, {}, UpdateIdentityGcpIamAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ allowedServiceAccounts,
+ allowedProjects,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityGcpIamAuth }
+ } = await apiRequest.patch<{ identityGcpIamAuth: IdentityGcpIamAuth }>(
+ `/api/v1/auth/gcp-iam-auth/identities/${identityId}`,
+ {
+ allowedServiceAccounts,
+ allowedProjects,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
++
+ return identityGcpIamAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+};
++
+ export const useUpdateIdentityAwsIamAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityAwsIamAuth, {}, UpdateIdentityAwsIamAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ stsEndpoint,
+ allowedPrincipalArns,
+ allowedAccountIds,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityAwsIamAuth }
+ } = await apiRequest.patch<{ identityAwsIamAuth: IdentityAwsIamAuth }>(
+ `/api/v1/auth/aws-iam-auth/identities/${identityId}`,
+ {
+ stsEndpoint,
+ allowedPrincipalArns,
+ allowedAccountIds,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
++
+ return identityAwsIamAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+ };
diff --cc frontend/src/hooks/api/identities/queries.tsx
index fee3b7f0e5,5d4a4aeef5..623f1b310b
--- a/frontend/src/hooks/api/identities/queries.tsx
+++ b/frontend/src/hooks/api/identities/queries.tsx
@@@ -2,14 -2,14 +2,20 @@@ import { useQuery } from "@tanstack/rea
import { apiRequest } from "@app/config/request";
- import { ClientSecretData, IdentityGcpIamAuth,IdentityUniversalAuth } from "./types";
-import { ClientSecretData, IdentityAwsIamAuth,IdentityUniversalAuth } from "./types";
++import {
++ ClientSecretData,
++ IdentityAwsIamAuth,
++ IdentityGcpIamAuth,
++ IdentityUniversalAuth
++} from "./types";
export const identitiesKeys = {
getIdentityUniversalAuth: (identityId: string) =>
[{ identityId }, "identity-universal-auth"] as const,
getIdentityUniversalAuthClientSecrets: (identityId: string) =>
[{ identityId }, "identity-universal-auth-client-secrets"] as const,
- getIdentityGcpIamAuth: (identityId: string) => [{ identityId }, "identity-gcp-iam-auth"] as const
++ getIdentityGcpIamAuth: (identityId: string) => [{ identityId }, "identity-gcp-iam-auth"] as const,
+ getIdentityAwsIamAuth: (identityId: string) => [{ identityId }, "identity-aws-iam-auth"] as const
};
export const useGetIdentityUniversalAuth = (identityId: string) => {
@@@ -46,17 -42,17 +48,32 @@@ export const useGetIdentityUniversalAut
});
};
+export const useGetIdentityGcpIamAuth = (identityId: string) => {
+ return useQuery({
+ enabled: Boolean(identityId),
+ queryKey: identitiesKeys.getIdentityGcpIamAuth(identityId),
+ queryFn: async () => {
+ const {
+ data: { identityGcpIamAuth }
+ } = await apiRequest.get<{ identityGcpIamAuth: IdentityGcpIamAuth }>(
+ `/api/v1/auth/gcp-iam-auth/identities/${identityId}`
+ );
+ return identityGcpIamAuth;
+ }
+ });
+};
++
+ export const useGetIdentityAwsIamAuth = (identityId: string) => {
+ return useQuery({
+ enabled: Boolean(identityId),
+ queryKey: identitiesKeys.getIdentityAwsIamAuth(identityId),
+ queryFn: async () => {
+ const {
+ data: { identityAwsIamAuth }
+ } = await apiRequest.get<{ identityAwsIamAuth: IdentityAwsIamAuth }>(
+ `/api/v1/auth/aws-iam-auth/identities/${identityId}`
+ );
+ return identityAwsIamAuth;
+ }
+ });
+ };
diff --cc frontend/src/hooks/api/identities/types.ts
index 2222fdf564,02b0e9f53c..bb904f462c
--- a/frontend/src/hooks/api/identities/types.ts
+++ b/frontend/src/hooks/api/identities/types.ts
@@@ -113,42 -113,45 +113,81 @@@ export type UpdateIdentityUniversalAuth
}[];
};
+export type IdentityGcpIamAuth = {
+ identityId: string;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: IdentityTrustedIp[];
+};
+
+export type AddIdentityGcpIamAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: {
+ ipAddress: string;
+ }[];
+};
+
+export type UpdateIdentityGcpIamAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ allowedServiceAccounts?: string;
+ allowedProjects?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: {
+ ipAddress: string;
+ }[];
+};
+
+ export type IdentityAwsIamAuth = {
+ identityId: string;
+ stsEndpoint: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: IdentityTrustedIp[];
+ };
+
+ export type AddIdentityAwsIamAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ stsEndpoint: string;
+ allowedPrincipalArns: string;
+ allowedAccountIds: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: {
+ ipAddress: string;
+ }[];
+ };
+
+ export type UpdateIdentityAwsIamAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ stsEndpoint?: string;
+ allowedPrincipalArns?: string;
+ allowedAccountIds?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: {
+ ipAddress: string;
+ }[];
+ };
+
export type CreateIdentityUniversalAuthClientSecretDTO = {
identityId: string;
description?: string;