Skip to content

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

Resolve merge conflicts

Tuan Dang184b59ad1dab
diff --cc backend/src/@types/fastify.d.ts
index 7f44b6ec3f,b39847f275..994b324f6d
--- a/backend/src/@types/fastify.d.ts
+++ b/backend/src/@types/fastify.d.ts
@@@ -32,8 -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 { TIdentityAwsAuthServiceFactory } from "@app/services/identity-aws-auth/identity-aws-auth-service";
+import { TIdentityGcpAuthServiceFactory } from "@app/services/identity-gcp-auth/identity-gcp-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";
@@@ -117,8 -116,7 +117,8 @@@ declare module "fastify"
identityAccessToken: TIdentityAccessTokenServiceFactory;
identityProject: TIdentityProjectServiceFactory;
identityUa: TIdentityUaServiceFactory;
+ identityGcpAuth: TIdentityGcpAuthServiceFactory;
- identityAwsIamAuth: TIdentityAwsIamAuthServiceFactory;
+ identityAwsAuth: TIdentityAwsAuthServiceFactory;
accessApprovalPolicy: TAccessApprovalPolicyServiceFactory;
accessApprovalRequest: TAccessApprovalRequestServiceFactory;
secretApprovalPolicy: TSecretApprovalPolicyServiceFactory;
diff --cc backend/src/@types/knex.d.ts
index c8884bde43,02d2e3981b..3a6aa549dc
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@@ -59,12 -59,9 +59,12 @@@ import
TIdentityAccessTokens,
TIdentityAccessTokensInsert,
TIdentityAccessTokensUpdate,
- TIdentityAwsIamAuths,
- TIdentityAwsIamAuthsInsert,
- TIdentityAwsIamAuthsUpdate,
+ TIdentityAwsAuths,
+ TIdentityAwsAuthsInsert,
+ TIdentityAwsAuthsUpdate,
+ TIdentityGcpAuths,
+ TIdentityGcpAuthsInsert,
+ TIdentityGcpAuthsUpdate,
TIdentityOrgMemberships,
TIdentityOrgMembershipsInsert,
TIdentityOrgMembershipsUpdate,
@@@ -332,15 -329,10 +332,15 @@@ declare module "knex/types/tables"
TIdentityUniversalAuthsInsert,
TIdentityUniversalAuthsUpdate
>;
+ [TableName.IdentityGcpAuth]: Knex.CompositeTableType<
+ TIdentityGcpAuths,
+ TIdentityGcpAuthsInsert,
+ TIdentityGcpAuthsUpdate
+ >;
- [TableName.IdentityAwsIamAuth]: Knex.CompositeTableType<
- TIdentityAwsIamAuths,
- TIdentityAwsIamAuthsInsert,
- TIdentityAwsIamAuthsUpdate
+ [TableName.IdentityAwsAuth]: Knex.CompositeTableType<
+ TIdentityAwsAuths,
+ TIdentityAwsAuthsInsert,
+ TIdentityAwsAuthsUpdate
>;
[TableName.IdentityUaClientSecret]: Knex.CompositeTableType<
TIdentityUaClientSecrets,
diff --cc backend/src/db/schemas/index.ts
index 9ad2c3e466,8bd00ff62b..4993003f94
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@@ -17,8 -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-aws-auths";
+export * from "./identity-gcp-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 952d185393,053c6411d3..4951de99eb
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@@ -44,9 -44,8 +44,9 @@@ export enum TableName
Identity = "identities",
IdentityAccessToken = "identity_access_tokens",
IdentityUniversalAuth = "identity_universal_auths",
+ IdentityGcpAuth = "identity_gcp_auths",
IdentityUaClientSecret = "identity_ua_client_secrets",
- IdentityAwsIamAuth = "identity_aws_iam_auths",
+ IdentityAwsAuth = "identity_aws_auths",
IdentityOrgMembership = "identity_org_memberships",
IdentityProjectMembership = "identity_project_memberships",
IdentityProjectMembershipRole = "identity_project_membership_role",
@@@ -145,6 -144,5 +145,6 @@@ export enum ProjectUpgradeStatus
export enum IdentityAuthMethod {
Univeral = "universal-auth",
+ GCP_AUTH = "gcp-auth",
- AWS_IAM_AUTH = "aws-iam-auth"
+ AWS_AUTH = "aws-auth"
}
diff --cc backend/src/ee/services/audit-log/audit-log-types.ts
index 86fe56c52a,1bebd96d60..81554a92fe
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@@ -66,14 -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_AUTH = "login-identity-gcp-auth",
+ ADD_IDENTITY_GCP_AUTH = "add-identity-gcp -auth",
+ UPDATE_IDENTITY_GCP_AUTH = "update-identity-gcp-auth",
+ GET_IDENTITY_GCP_AUTH = "get-identity-gcp-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",
+ LOGIN_IDENTITY_AWS_AUTH = "login-identity-aws-auth",
+ ADD_IDENTITY_AWS_AUTH = "add-identity-aws-auth",
+ UPDATE_IDENTITY_AWS_AUTH = "update-identity-aws-auth",
+ GET_IDENTITY_AWS_AUTH = "get-identity-aws-auth",
CREATE_ENVIRONMENT = "create-environment",
UPDATE_ENVIRONMENT = "update-environment",
DELETE_ENVIRONMENT = "delete-environment",
@@@ -414,57 -410,11 +414,57 @@@ interface RevokeIdentityUniversalAuthCl
};
}
+interface LoginIdentityGcpAuthEvent {
+ type: EventType.LOGIN_IDENTITY_GCP_AUTH;
+ metadata: {
+ identityId: string;
+ identityGcpAuthId: string;
+ identityAccessTokenId: string;
+ };
+}
+
+interface AddIdentityGcpAuthEvent {
+ type: EventType.ADD_IDENTITY_GCP_AUTH;
+ metadata: {
+ identityId: string;
+ type: string;
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface UpdateIdentityGcpAuthEvent {
+ type: EventType.UPDATE_IDENTITY_GCP_AUTH;
+ metadata: {
+ identityId: string;
+ type?: string;
+ allowedServiceAccounts?: string;
+ allowedProjects?: string;
+ allowedZones?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: Array<TIdentityTrustedIp>;
+ };
+}
+
+interface GetIdentityGcpAuthEvent {
+ type: EventType.GET_IDENTITY_GCP_AUTH;
+ metadata: {
+ identityId: string;
+ };
+}
+
- interface LoginIdentityAwsIamAuthEvent {
- type: EventType.LOGIN_IDENTITY_AWS_IAM_AUTH;
+ interface LoginIdentityAwsAuthEvent {
+ type: EventType.LOGIN_IDENTITY_AWS_AUTH;
metadata: {
identityId: string;
- identityAwsIamAuthId: string;
+ identityAwsAuthId: string;
identityAccessTokenId: string;
};
}
@@@ -758,14 -708,10 +758,14 @@@ export type Event
| CreateIdentityUniversalAuthClientSecretEvent
| GetIdentityUniversalAuthClientSecretsEvent
| RevokeIdentityUniversalAuthClientSecretEvent
+ | LoginIdentityGcpAuthEvent
+ | AddIdentityGcpAuthEvent
+ | UpdateIdentityGcpAuthEvent
+ | GetIdentityGcpAuthEvent
- | LoginIdentityAwsIamAuthEvent
- | AddIdentityAwsIamAuthEvent
- | UpdateIdentityAwsIamAuthEvent
- | GetIdentityAwsIamAuthEvent
+ | LoginIdentityAwsAuthEvent
+ | AddIdentityAwsAuthEvent
+ | UpdateIdentityAwsAuthEvent
+ | GetIdentityAwsAuthEvent
| CreateEnvironmentEvent
| UpdateEnvironmentEvent
| DeleteEnvironmentEvent
diff --cc backend/src/server/routes/index.ts
index e14329b9d8,7aecf35c80..5eb46e861f
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@@ -78,10 -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 { identityAwsAuthDALFactory } from "@app/services/identity-aws-auth/identity-aws-auth-dal";
+ import { identityAwsAuthServiceFactory } from "@app/services/identity-aws-auth/identity-aws-auth-service";
+import { identityGcpAuthDALFactory } from "@app/services/identity-gcp-auth/identity-gcp-auth-dal";
+import { identityGcpAuthServiceFactory } from "@app/services/identity-gcp-auth/identity-gcp-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";
@@@ -205,10 -203,8 +205,10 @@@ export const registerRoutes = async
const identityUaDAL = identityUaDALFactory(db);
const identityUaClientSecretDAL = identityUaClientSecretDALFactory(db);
- const identityAwsIamAuthDAL = identityAwsIamAuthDALFactory(db);
+ const identityAwsAuthDAL = identityAwsAuthDALFactory(db);
+ const identityGcpAuthDAL = identityGcpAuthDALFactory(db);
+
const auditLogDAL = auditLogDALFactory(db);
const auditLogStreamDAL = auditLogStreamDALFactory(db);
const trustedIpDAL = trustedIpDALFactory(db);
@@@ -706,19 -702,9 +706,19 @@@
identityUaDAL,
licenseService
});
+ const identityGcpAuthService = identityGcpAuthServiceFactory({
+ identityGcpAuthDAL,
+ identityOrgMembershipDAL,
+ identityAccessTokenDAL,
+ identityDAL,
+ orgBotDAL,
+ permissionService,
+ licenseService
+ });
+
- const identityAWSIAMAuthService = identityAwsIamAuthServiceFactory({
+ const identityAwsAuthService = identityAwsAuthServiceFactory({
identityAccessTokenDAL,
- identityAwsIamAuthDAL,
+ identityAwsAuthDAL,
identityOrgMembershipDAL,
identityDAL,
licenseService,
@@@ -793,8 -779,7 +793,8 @@@
identityAccessToken: identityAccessTokenService,
identityProject: identityProjectService,
identityUa: identityUaService,
+ identityGcpAuth: identityGcpAuthService,
- identityAwsIamAuth: identityAWSIAMAuthService,
+ identityAwsAuth: identityAwsAuthService,
secretApprovalPolicy: sapService,
accessApprovalPolicy: accessApprovalPolicyService,
accessApprovalRequest: accessApprovalRequestService,
diff --cc backend/src/server/routes/v1/index.ts
index 406f78be62,6907fd040c..75d6a80ff8
--- a/backend/src/server/routes/v1/index.ts
+++ b/backend/src/server/routes/v1/index.ts
@@@ -2,8 -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 { registerIdentityAwsAuthRouter } from "./identity-aws-iam-auth-router";
+import { registerIdentityGcpAuthRouter } from "./identity-gcp-auth-router";
import { registerIdentityRouter } from "./identity-router";
import { registerIdentityUaRouter } from "./identity-ua";
import { registerIntegrationAuthRouter } from "./integration-auth-router";
@@@ -29,9 -28,8 +29,10 @@@ export const registerV1Routes = async (
async (authRouter) => {
await authRouter.register(registerAuthRoutes);
await authRouter.register(registerIdentityUaRouter);
+ await authRouter.register(registerIdentityGcpAuthRouter);
- await authRouter.register(registerIdentityAwsIamAuthRouter);
+ await authRouter.register(registerIdentityAccessTokenRouter);
+ await authRouter.register(registerIdentityAccessTokenRouter);
+ await authRouter.register(registerIdentityAwsAuthRouter);
},
{ prefix: "/auth" }
);
diff --cc docs/documentation/platform/identities/machine-identities.mdx
index cd8ab2cbec,e70458c9cb..35ede887e4
--- a/docs/documentation/platform/identities/machine-identities.mdx
+++ b/docs/documentation/platform/identities/machine-identities.mdx
@@@ -7,7 -7,7 +7,7 @@@ description: "Learn how to use Machine
An Infisical machine identity is an entity that represents a workload or application that require access to various resources in Infisical. This is conceptually similar to an IAM user in AWS or service account in Google Cloud Platform (GCP).
- Each identity must authenticate with the Infisical API using a supported authentication method like [Universal Auth](/documentation/platform/identities/universal-auth), [AWS IAM Auth](/documentation/platform/identities/aws-iam-auth), or [GCP IAM Auth](/documentation/platform/identities/gcp-auth) to get back a short-lived access token to be used in subsequent requests.
-Each identity must authenticate using a supported authentication method like [Universal Auth](/documentation/platform/identities/universal-auth) or [AWS Auth](/documentation/platform/identities/aws-auth) to get back a short-lived access token to be used in subsequent requests.
++Each identity must authenticate with the Infisical API using a supported authentication method like [Universal Auth](/documentation/platform/identities/universal-auth), [AWS Auth](/documentation/platform/identities/aws-auth), or [GCP Auth](/documentation/platform/identities/gcp-auth) to get back a short-lived access token to be used in subsequent requests.
![organization identities](/images/platform/organization/organization-machine-identities.png)
@@@ -38,8 -38,7 +38,8 @@@ Machine Identity support for the rest o
To interact with various resources in Infisical, Machine Identities are able to authenticate using:
- [Universal Auth](/documentation/platform/identities/universal-auth): A platform-agnostic authentication method that can be configured on an identity suitable to authenticate from any platform/environment.
- - [AWS IAM Auth](/documentation/platform/identities/aws-iam-auth): An AWS-native authentication method for IAM principals like EC2 instances or Lambda functions to authenticate with Infisical.
- - [GCP IAM Auth](/documentation/platform/identities/gcp-auth): A GCP-native authentication method for IAM service accounts to authenticate with Infisical.
+ - [AWS Auth](/documentation/platform/identities/aws-auth): An AWS-native authentication method for IAM principals like EC2 instances or Lambda functions to authenticate with Infisical.
++- [GCP Auth](/documentation/platform/identities/gcp-auth): A GCP-native authentication method for IAM service accounts and GCE instances to authenticate with Infisical.
## FAQ
diff --cc docs/mint.json
index 916a9ca2f3,d499f3cac5..4a106a79cf
--- a/docs/mint.json
+++ b/docs/mint.json
@@@ -153,8 -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-auth",
+ "documentation/platform/identities/aws-auth",
"documentation/platform/mfa",
{
"group": "SSO",
diff --cc frontend/src/hooks/api/identities/constants.tsx
index 798a13b882,64f9469c6d..d2669a308b
--- a/frontend/src/hooks/api/identities/constants.tsx
+++ b/frontend/src/hooks/api/identities/constants.tsx
@@@ -2,6 -2,5 +2,6 @@@ import { IdentityAuthMethod } from "./e
export const identityAuthToNameMap: { [I in IdentityAuthMethod]: string } = {
[IdentityAuthMethod.UNIVERSAL_AUTH]: "Universal Auth",
+ [IdentityAuthMethod.GCP_AUTH]: "GCP Auth",
- [IdentityAuthMethod.AWS_IAM_AUTH]: "AWS IAM Auth"
+ [IdentityAuthMethod.AWS_AUTH]: "AWS Auth"
};
diff --cc frontend/src/hooks/api/identities/enums.tsx
index be50c72adb,dc619f722e..a67776c877
--- a/frontend/src/hooks/api/identities/enums.tsx
+++ b/frontend/src/hooks/api/identities/enums.tsx
@@@ -1,5 -1,4 +1,5 @@@
export enum IdentityAuthMethod {
UNIVERSAL_AUTH = "universal-auth",
+ GCP_AUTH = "gcp-auth",
- AWS_IAM_AUTH = "aws-iam-auth"
+ AWS_AUTH = "aws-auth"
}
diff --cc frontend/src/hooks/api/identities/index.tsx
index bd7347f882,cef827d9f9..d59e096c09
--- a/frontend/src/hooks/api/identities/index.tsx
+++ b/frontend/src/hooks/api/identities/index.tsx
@@@ -1,21 -1,18 +1,20 @@@
export { identityAuthToNameMap } from "./constants";
export { IdentityAuthMethod } from "./enums";
export {
- useAddIdentityAwsIamAuth,
+ useAddIdentityAwsAuth,
+ useAddIdentityGcpAuth,
useAddIdentityUniversalAuth,
useCreateIdentity,
useCreateIdentityUniversalAuthClientSecret,
useDeleteIdentity,
useRevokeIdentityUniversalAuthClientSecret,
useUpdateIdentity,
- useUpdateIdentityAwsIamAuth,
+ useUpdateIdentityAwsAuth,
- useUpdateIdentityUniversalAuth
-} from "./mutations";
+ useUpdateIdentityGcpAuth,
- useUpdateIdentityUniversalAuth
- } from "./mutations";
++ useUpdateIdentityUniversalAuth} from "./mutations";
export {
- useGetIdentityAwsIamAuth,
+ useGetIdentityAwsAuth,
+ useGetIdentityGcpAuth,
useGetIdentityUniversalAuth,
useGetIdentityUniversalAuthClientSecrets
} from "./queries";
diff --cc frontend/src/hooks/api/identities/mutations.tsx
index e2cdc8841f,8780f178db..527f74f160
--- a/frontend/src/hooks/api/identities/mutations.tsx
+++ b/frontend/src/hooks/api/identities/mutations.tsx
@@@ -5,8 -5,7 +5,8 @@@ import { apiRequest } from "@app/config
import { organizationKeys } from "../organization/queries";
import { identitiesKeys } from "./queries";
import {
- AddIdentityAwsIamAuthDTO,
+ AddIdentityAwsAuthDTO,
+ AddIdentityGcpAuthDTO,
AddIdentityUniversalAuthDTO,
ClientSecretData,
CreateIdentityDTO,
@@@ -15,12 -14,10 +15,12 @@@
DeleteIdentityDTO,
DeleteIdentityUniversalAuthClientSecretDTO,
Identity,
- IdentityAwsIamAuth,
+ IdentityAwsAuth,
+ IdentityGcpAuth,
IdentityUniversalAuth,
- UpdateIdentityAwsIamAuthDTO,
+ UpdateIdentityAwsAuthDTO,
UpdateIdentityDTO,
+ UpdateIdentityGcpAuthDTO,
UpdateIdentityUniversalAuthDTO
} from "./types";
@@@ -176,89 -173,9 +176,89 @@@ export const useRevokeIdentityUniversal
});
};
+export const useAddIdentityGcpAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityGcpAuth, {}, AddIdentityGcpAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ credentials,
+ type,
+ allowedServiceAccounts,
+ allowedProjects,
+ allowedZones,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityGcpAuth }
+ } = await apiRequest.post<{ identityGcpAuth: IdentityGcpAuth }>(
+ `/api/v1/auth/gcp-auth/identities/${identityId}`,
+ {
+ credentials,
+ type,
+ allowedServiceAccounts,
+ allowedProjects,
+ allowedZones,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityGcpAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+};
+
+export const useUpdateIdentityGcpAuth = () => {
+ const queryClient = useQueryClient();
+ return useMutation<IdentityGcpAuth, {}, UpdateIdentityGcpAuthDTO>({
+ mutationFn: async ({
+ identityId,
+ credentials,
+ type,
+ allowedServiceAccounts,
+ allowedProjects,
+ allowedZones,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }) => {
+ const {
+ data: { identityGcpAuth }
+ } = await apiRequest.patch<{ identityGcpAuth: IdentityGcpAuth }>(
+ `/api/v1/auth/gcp-auth/identities/${identityId}`,
+ {
+ credentials,
+ type,
+ allowedServiceAccounts,
+ allowedProjects,
+ allowedZones,
+ accessTokenTTL,
+ accessTokenMaxTTL,
+ accessTokenNumUsesLimit,
+ accessTokenTrustedIps
+ }
+ );
+
+ return identityGcpAuth;
+ },
+ onSuccess: (_, { organizationId }) => {
+ queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
+ }
+ });
+};
+
- export const useAddIdentityAwsIamAuth = () => {
+ export const useAddIdentityAwsAuth = () => {
const queryClient = useQueryClient();
- return useMutation<IdentityAwsIamAuth, {}, AddIdentityAwsIamAuthDTO>({
+ return useMutation<IdentityAwsAuth, {}, AddIdentityAwsAuthDTO>({
mutationFn: async ({
identityId,
stsEndpoint,
@@@ -319,8 -236,7 +319,8 @@@ export const useUpdateIdentityAwsAuth
accessTokenTrustedIps
}
);
+
- return identityAwsIamAuth;
+ return identityAwsAuth;
},
onSuccess: (_, { organizationId }) => {
queryClient.invalidateQueries(organizationKeys.getOrgIdentityMemberships(organizationId));
diff --cc frontend/src/hooks/api/identities/queries.tsx
index 62f139f5fe,26880d5ea7..2996f275f0
--- a/frontend/src/hooks/api/identities/queries.tsx
+++ b/frontend/src/hooks/api/identities/queries.tsx
@@@ -2,20 -2,14 +2,15 @@@ import { useQuery } from "@tanstack/rea
import { apiRequest } from "@app/config/request";
- import {
- ClientSecretData,
- IdentityAwsIamAuth,
- IdentityGcpAuth,
- IdentityUniversalAuth
- } from "./types";
-import { ClientSecretData, IdentityAwsAuth, IdentityUniversalAuth } from "./types";
++import { ClientSecretData, IdentityAwsAuth, IdentityGcpAuth, 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,
+ getIdentityGcpAuth: (identityId: string) => [{ identityId }, "identity-gcp-auth"] as const,
- getIdentityAwsIamAuth: (identityId: string) => [{ identityId }, "identity-aws-iam-auth"] as const
+ getIdentityAwsAuth: (identityId: string) => [{ identityId }, "identity-aws-auth"] as const
};
export const useGetIdentityUniversalAuth = (identityId: string) => {
@@@ -48,32 -42,17 +43,32 @@@ export const useGetIdentityUniversalAut
});
};
+export const useGetIdentityGcpAuth = (identityId: string) => {
+ return useQuery({
+ enabled: Boolean(identityId),
+ queryKey: identitiesKeys.getIdentityGcpAuth(identityId),
+ queryFn: async () => {
+ const {
+ data: { identityGcpAuth }
+ } = await apiRequest.get<{ identityGcpAuth: IdentityGcpAuth }>(
+ `/api/v1/auth/gcp-auth/identities/${identityId}`
+ );
+ return identityGcpAuth;
+ }
+ });
+};
+
- export const useGetIdentityAwsIamAuth = (identityId: string) => {
+ export const useGetIdentityAwsAuth = (identityId: string) => {
return useQuery({
enabled: Boolean(identityId),
- queryKey: identitiesKeys.getIdentityAwsIamAuth(identityId),
+ queryKey: identitiesKeys.getIdentityAwsAuth(identityId),
queryFn: async () => {
const {
- data: { identityAwsIamAuth }
- } = await apiRequest.get<{ identityAwsIamAuth: IdentityAwsIamAuth }>(
- `/api/v1/auth/aws-iam-auth/identities/${identityId}`
+ data: { identityAwsAuth }
+ } = await apiRequest.get<{ identityAwsAuth: IdentityAwsAuth }>(
+ `/api/v1/auth/aws-auth/identities/${identityId}`
);
- return identityAwsIamAuth;
+ return identityAwsAuth;
}
});
};
diff --cc frontend/src/hooks/api/identities/types.ts
index 6cdb05a8c8,1a7ba263ff..a630965625
--- a/frontend/src/hooks/api/identities/types.ts
+++ b/frontend/src/hooks/api/identities/types.ts
@@@ -113,53 -113,9 +113,54 @@@ export type UpdateIdentityUniversalAuth
}[];
};
+export type IdentityGcpAuth = {
+ identityId: string;
+ credentials: string;
+ type: "iam" | "gce";
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: IdentityTrustedIp[];
+};
+
+export type AddIdentityGcpAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ credentials: string;
+ type: "iam" | "gce";
+ allowedServiceAccounts: string;
+ allowedProjects: string;
+ allowedZones: string;
+ accessTokenTTL: number;
+ accessTokenMaxTTL: number;
+ accessTokenNumUsesLimit: number;
+ accessTokenTrustedIps: {
+ ipAddress: string;
+ }[];
+};
+
+export type UpdateIdentityGcpAuthDTO = {
+ organizationId: string;
+ identityId: string;
+ credentials?: string;
+ type?: "iam" | "gce";
+ allowedServiceAccounts?: string;
+ allowedProjects?: string;
+ allowedZones?: string;
+ accessTokenTTL?: number;
+ accessTokenMaxTTL?: number;
+ accessTokenNumUsesLimit?: number;
+ accessTokenTrustedIps?: {
+ ipAddress: string;
+ }[];
+};
+
- export type IdentityAwsIamAuth = {
+ export type IdentityAwsAuth = {
identityId: string;
+ type: "iam";
stsEndpoint: string;
allowedPrincipalArns: string;
allowedAccountIds: string;
diff --cc frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
index 994672ee14,22fbfee5e2..74c4c7f6de
--- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
+++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
@@@ -14,8 -14,7 +14,8 @@@ import
import { IdentityAuthMethod } from "@app/hooks/api/identities";
import { UsePopUpState } from "@app/hooks/usePopUp";
- import { IdentityAwsIamAuthForm } from "./IdentityAwsIamAuthForm";
+ import { IdentityAwsAuthForm } from "./IdentityAwsAuthForm";
+import { IdentityGcpAuthForm } from "./IdentityGcpAuthForm";
import { IdentityUniversalAuthForm } from "./IdentityUniversalAuthForm";
type Props = {
@@@ -29,8 -28,7 +29,8 @@@
const identityAuthMethods = [
{ label: "Universal Auth", value: IdentityAuthMethod.UNIVERSAL_AUTH },
- { label: "AWS IAM Auth", value: IdentityAuthMethod.AWS_IAM_AUTH },
- { label: "GCP Auth", value: IdentityAuthMethod.GCP_AUTH }
++ { label: "GCP Auth", value: IdentityAuthMethod.GCP_AUTH },
+ { label: "AWS Auth", value: IdentityAuthMethod.AWS_AUTH }
];
const schema = yup
@@@ -68,20 -66,11 +68,20 @@@ export const IdentityAuthMethodModal =
const renderIdentityAuthForm = () => {
switch (identityAuthMethodData?.authMethod ?? authMethod) {
- case IdentityAuthMethod.AWS_IAM_AUTH: {
+ case IdentityAuthMethod.AWS_AUTH: {
return (
- <IdentityAwsIamAuthForm
+ <IdentityAwsAuthForm
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
+ identityAuthMethodData={identityAuthMethodData}
+ />
+ );
+ }
+ case IdentityAuthMethod.GCP_AUTH: {
+ return (
+ <IdentityGcpAuthForm
+ handlePopUpOpen={handlePopUpOpen}
+ handlePopUpToggle={handlePopUpToggle}
identityAuthMethodData={identityAuthMethodData}
/>
);