diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts index 207927d138..b54f7acec0 100644 --- a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts +++ b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts @@ -13,7 +13,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedErro import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -33,7 +32,6 @@ type TIdentityAwsAuthServiceFactoryDep = { identityAccessTokenDAL: Pick; identityAwsAuthDAL: Pick; identityOrgMembershipDAL: Pick; - // identityDAL: Pick; licenseService: Pick; permissionService: Pick; }; @@ -44,7 +42,6 @@ export const identityAwsAuthServiceFactory = ({ identityAccessTokenDAL, identityAwsAuthDAL, identityOrgMembershipDAL, - // identityDAL, licenseService, permissionService }: TIdentityAwsAuthServiceFactoryDep) => { @@ -231,7 +228,7 @@ export const identityAwsAuthServiceFactory = ({ if (!identityMembershipOrg) throw new NotFoundError({ message: "Failed to find identity" }); if (!identityMembershipOrg.identity.authMethods.includes(IdentityAuthMethod.AWS_AUTH)) { throw new NotFoundError({ - message: "he identity does not have AWS Auth attached" + message: "The identity does not have AWS Auth attached" }); } @@ -346,7 +343,6 @@ export const identityAwsAuthServiceFactory = ({ const revokedIdentityAwsAuth = await identityAwsAuthDAL.transaction(async (tx) => { const deletedAwsAuth = await identityAwsAuthDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedAwsAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityAwsAuth; diff --git a/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts b/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts index ac31383985..fe48246517 100644 --- a/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts +++ b/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts @@ -11,7 +11,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedErro import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -32,7 +31,6 @@ type TIdentityAzureAuthServiceFactoryDep = { >; identityOrgMembershipDAL: Pick; identityAccessTokenDAL: Pick; - // identityDAL: Pick; permissionService: Pick; licenseService: Pick; }; @@ -43,7 +41,6 @@ export const identityAzureAuthServiceFactory = ({ identityAzureAuthDAL, identityOrgMembershipDAL, identityAccessTokenDAL, - // identityDAL, permissionService, licenseService }: TIdentityAzureAuthServiceFactoryDep) => { @@ -319,7 +316,6 @@ export const identityAzureAuthServiceFactory = ({ const revokedIdentityAzureAuth = await identityAzureAuthDAL.transaction(async (tx) => { const deletedAzureAuth = await identityAzureAuthDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedAzureAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityAzureAuth; diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts index 605db3016b..cb4ea85a88 100644 --- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts +++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts @@ -11,7 +11,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedErro import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -30,7 +29,6 @@ type TIdentityGcpAuthServiceFactoryDep = { identityGcpAuthDAL: Pick; identityOrgMembershipDAL: Pick; identityAccessTokenDAL: Pick; - // identityDAL: Pick; permissionService: Pick; licenseService: Pick; }; @@ -41,7 +39,6 @@ export const identityGcpAuthServiceFactory = ({ identityGcpAuthDAL, identityOrgMembershipDAL, identityAccessTokenDAL, - // identityDAL, permissionService, licenseService }: TIdentityGcpAuthServiceFactoryDep) => { @@ -364,7 +361,6 @@ export const identityGcpAuthServiceFactory = ({ const revokedIdentityGcpAuth = await identityGcpAuthDAL.transaction(async (tx) => { const deletedGcpAuth = await identityGcpAuthDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedGcpAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityGcpAuth; diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts index c7dd1d73aa..9d84ddb889 100644 --- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts +++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts @@ -22,7 +22,6 @@ import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { TOrgBotDALFactory } from "@app/services/org/org-bot-dal"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -44,7 +43,6 @@ type TIdentityKubernetesAuthServiceFactoryDep = { >; identityAccessTokenDAL: Pick; identityOrgMembershipDAL: Pick; - // identityDAL: Pick; orgBotDAL: Pick; permissionService: Pick; licenseService: Pick; @@ -56,7 +54,6 @@ export const identityKubernetesAuthServiceFactory = ({ identityKubernetesAuthDAL, identityOrgMembershipDAL, identityAccessTokenDAL, - // identityDAL, orgBotDAL, permissionService, licenseService @@ -604,7 +601,6 @@ export const identityKubernetesAuthServiceFactory = ({ const revokedIdentityKubernetesAuth = await identityKubernetesAuthDAL.transaction(async (tx) => { const deletedKubernetesAuth = await identityKubernetesAuthDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedKubernetesAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityKubernetesAuth; diff --git a/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts b/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts index c5d8af1e4a..247dee87d2 100644 --- a/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts +++ b/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts @@ -22,7 +22,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedErro import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -41,7 +40,6 @@ type TIdentityOidcAuthServiceFactoryDep = { identityOidcAuthDAL: TIdentityOidcAuthDALFactory; identityOrgMembershipDAL: Pick; identityAccessTokenDAL: Pick; - // identityDAL: Pick; permissionService: Pick; licenseService: Pick; orgBotDAL: Pick; @@ -52,7 +50,6 @@ export type TIdentityOidcAuthServiceFactory = ReturnType { const deletedOidcAuth = await identityOidcAuthDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedOidcAuth?.[0], orgId: identityMembershipOrg.orgId }; }); diff --git a/backend/src/services/identity-token-auth/identity-token-auth-service.ts b/backend/src/services/identity-token-auth/identity-token-auth-service.ts index 9f5c2db36b..a5d304b1b7 100644 --- a/backend/src/services/identity-token-auth/identity-token-auth-service.ts +++ b/backend/src/services/identity-token-auth/identity-token-auth-service.ts @@ -11,7 +11,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/ import { extractIPDetails, isValidIpOrCidr } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -32,7 +31,6 @@ type TIdentityTokenAuthServiceFactoryDep = { TIdentityTokenAuthDALFactory, "transaction" | "create" | "findOne" | "updateById" | "delete" >; - // identityDAL: Pick; identityOrgMembershipDAL: Pick; identityAccessTokenDAL: Pick< TIdentityAccessTokenDALFactory, @@ -256,7 +254,6 @@ export const identityTokenAuthServiceFactory = ({ authMethod: IdentityAuthMethod.TOKEN_AUTH }); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedTokenAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityTokenAuth; diff --git a/backend/src/services/identity-ua/identity-ua-service.ts b/backend/src/services/identity-ua/identity-ua-service.ts index 509af8462d..50356c2c0b 100644 --- a/backend/src/services/identity-ua/identity-ua-service.ts +++ b/backend/src/services/identity-ua/identity-ua-service.ts @@ -14,7 +14,6 @@ import { BadRequestError, ForbiddenRequestError, NotFoundError, UnauthorizedErro import { checkIPAgainstBlocklist, extractIPDetails, isValidIpOrCidr, TIp } from "@app/lib/ip"; import { ActorType, AuthTokenType } from "../auth/auth-type"; -// import { TIdentityDALFactory } from "../identity/identity-dal"; import { TIdentityOrgDALFactory } from "../identity/identity-org-dal"; import { TIdentityAccessTokenDALFactory } from "../identity-access-token/identity-access-token-dal"; import { TIdentityAccessTokenJwtPayload } from "../identity-access-token/identity-access-token-types"; @@ -36,7 +35,6 @@ type TIdentityUaServiceFactoryDep = { identityUaClientSecretDAL: TIdentityUaClientSecretDALFactory; identityAccessTokenDAL: TIdentityAccessTokenDALFactory; identityOrgMembershipDAL: TIdentityOrgDALFactory; - // identityDAL: Pick; permissionService: Pick; licenseService: Pick; }; @@ -48,7 +46,6 @@ export const identityUaServiceFactory = ({ identityUaClientSecretDAL, identityAccessTokenDAL, identityOrgMembershipDAL, - // identityDAL, permissionService, licenseService }: TIdentityUaServiceFactoryDep) => { @@ -374,7 +371,6 @@ export const identityUaServiceFactory = ({ const revokedIdentityUniversalAuth = await identityUaDAL.transaction(async (tx) => { const deletedUniversalAuth = await identityUaDAL.delete({ identityId }, tx); - // await identityDAL.updateById(identityId, { authMethod: null }, tx); return { ...deletedUniversalAuth?.[0], orgId: identityMembershipOrg.orgId }; }); return revokedIdentityUniversalAuth; diff --git a/backend/src/services/identity/identity-org-dal.ts b/backend/src/services/identity/identity-org-dal.ts index 92d5dfab43..31ffff07fd 100644 --- a/backend/src/services/identity/identity-org-dal.ts +++ b/backend/src/services/identity/identity-org-dal.ts @@ -141,7 +141,7 @@ export const identityOrgDALFactory = (db: TDbClient) => { tx?: Knex ) => { try { - const paginatedIdentitySubquery = (tx || db.replicaNode())(TableName.Identity) + const paginatedIdentity = (tx || db.replicaNode())(TableName.Identity) .join( TableName.IdentityOrgMembership, `${TableName.IdentityOrgMembership}.identityId`, @@ -151,21 +151,18 @@ export const identityOrgDALFactory = (db: TDbClient) => { .select( selectAllTableCols(TableName.IdentityOrgMembership), db.ref("name").withSchema(TableName.Identity).as("identityName") - // db.ref("authMethod").withSchema(TableName.Identity).as("identityAuthMethod") ) .where(filter) .as("paginatedIdentity"); if (search?.length) { - void paginatedIdentitySubquery.whereILike(`${TableName.Identity}.name`, `%${search}%`); + void paginatedIdentity.whereILike(`${TableName.Identity}.name`, `%${search}%`); } if (limit) { - void paginatedIdentitySubquery.offset(offset).limit(limit); + void paginatedIdentity.offset(offset).limit(limit); } - const paginatedIdentity = paginatedIdentitySubquery.as("paginatedIdentity"); - // akhilmhdh: refer this for pagination with multiple left queries type TSubquery = Awaited; const query = (tx || db.replicaNode()) @@ -221,7 +218,7 @@ export const identityOrgDALFactory = (db: TDbClient) => { db.ref("orgId").withSchema("paginatedIdentity"), db.ref("createdAt").withSchema("paginatedIdentity"), db.ref("updatedAt").withSchema("paginatedIdentity"), - db.ref("identityId").withSchema("paginatedIdentity").as("identityNewId"), + db.ref("identityId").withSchema("paginatedIdentity").as("identityId"), db.ref("identityName").withSchema("paginatedIdentity"), db.ref("id").as("uaId").withSchema(TableName.IdentityUniversalAuth), @@ -258,7 +255,7 @@ export const identityOrgDALFactory = (db: TDbClient) => { crSlug, crPermission, crName, - identityNewId, + identityId, identityName, role, roleId, @@ -276,7 +273,7 @@ export const identityOrgDALFactory = (db: TDbClient) => { }) => ({ role, roleId, - identityId: identityNewId, + identityId, id, orgId, @@ -292,7 +289,7 @@ export const identityOrgDALFactory = (db: TDbClient) => { } : undefined, identity: { - id: identityNewId, + id: identityId, name: identityName, authMethods: buildAuthMethods({ uaId, diff --git a/frontend/src/components/v2/Select/Select.tsx b/frontend/src/components/v2/Select/Select.tsx index 035a851b2f..cfc70450b1 100644 --- a/frontend/src/components/v2/Select/Select.tsx +++ b/frontend/src/components/v2/Select/Select.tsx @@ -127,7 +127,7 @@ export const SelectItem = forwardRef( cursor-pointer select-none items-center overflow-hidden text-ellipsis whitespace-nowrap rounded-md py-2 pl-10 pr-4 text-sm outline-none transition-all hover:bg-mineshaft-500 data-[highlighted]:bg-mineshaft-700/80`, isSelected && "bg-primary", - isDisabled && "cursor-not-allowed text-gray-600 opacity-80 hover:!bg-transparent", + isDisabled && "cursor-not-allowed text-gray-600 opacity-80 hover:!bg-transparent", className )} ref={forwardedRef} diff --git a/frontend/src/hooks/api/identities/mutations.tsx b/frontend/src/hooks/api/identities/mutations.tsx index f7a4b7cf53..21c4c560e1 100644 --- a/frontend/src/hooks/api/identities/mutations.tsx +++ b/frontend/src/hooks/api/identities/mutations.tsx @@ -137,7 +137,6 @@ export const useUpdateIdentityUniversalAuth = () => { return useMutation({ mutationFn: async ({ identityId, - clientSecretTrustedIps, accessTokenTTL, accessTokenMaxTTL, diff --git a/frontend/src/views/Org/IdentityPage/IdentityPage.tsx b/frontend/src/views/Org/IdentityPage/IdentityPage.tsx index fa61727b54..0e2a88a750 100644 --- a/frontend/src/views/Org/IdentityPage/IdentityPage.tsx +++ b/frontend/src/views/Org/IdentityPage/IdentityPage.tsx @@ -216,13 +216,12 @@ export const IdentityPage = withPermission( handlePopUpOpen("identityAuthMethod", { identityId, name: data.identity.name, - authMethod: selectedAuthMethod, allAuthMethods: data.identity.authMethods }); }} disabled={!isAllowed} > - {`${data.identity.authMethods?.[0] ? "Edit" : "Configure"} Auth Method`} + Add new auth method )} diff --git a/frontend/src/views/Org/IdentityPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx b/frontend/src/views/Org/IdentityPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx index ec3455efd5..9d1d97a1d6 100644 --- a/frontend/src/views/Org/IdentityPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx +++ b/frontend/src/views/Org/IdentityPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx @@ -70,7 +70,6 @@ export const IdentityAuthenticationSection = ({ handlePopUpOpen("identityAuthMethod", { identityId, name: data.identity.name, - // authMethod: IdentityAuthMethod.UNIVERSAL_AUTH, allAuthMethods: data.identity.authMethods }) } diff --git a/frontend/src/views/Org/IdentityPage/components/IdentityClientSecretModal.tsx b/frontend/src/views/Org/IdentityPage/components/IdentityClientSecretModal.tsx index 228a774705..3f4de4fc19 100644 --- a/frontend/src/views/Org/IdentityPage/components/IdentityClientSecretModal.tsx +++ b/frontend/src/views/Org/IdentityPage/components/IdentityClientSecretModal.tsx @@ -62,8 +62,6 @@ export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) = identityId: string; }; - console.log(popUpData); - const onFormSubmit = async ({ description, ttl, numUsesLimit }: FormData) => { try { const { clientSecret } = await createClientSecret({ diff --git a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx index 80104e2de2..db5f428196 100644 --- a/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx +++ b/frontend/src/views/Org/MembersPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx @@ -292,18 +292,12 @@ export const IdentityAuthMethodModal = ({ popUp, handlePopUpOpen, handlePopUpTog deleteKey="confirm" buttonText="Remove" onDeleteApproved={async () => { - if (!identityAuthMethodData.authMethod || !orgId) { - return; - } - - const selectedRevoke = methodMap[identityAuthMethodData.authMethod]; - - if (!selectedRevoke) { + if (!identityAuthMethodData.authMethod || !orgId || !selectedMethodItem) { return; } try { - await selectedRevoke.revokeMethod({ + await selectedMethodItem.revokeMethod({ identityId: identityAuthMethodData.identityId, organizationId: orgId });