Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement: refactor identity auth forms/modals to v3 components and add the ability to manage auth from table view
Scott Wilsonf76bb1f686cb
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 2c5ba47595..f324cd4827 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -792,7 +792,8 @@ export const registerRoutes = async (permissionService,roleDAL,additionalPrivilegeDAL,- licenseService+ licenseService,+ keyStore});const membershipGroupService = membershipGroupServiceFactory({diff --git a/backend/src/server/routes/v1/identity-org-membership-router.ts b/backend/src/server/routes/v1/identity-org-membership-router.tsindex d1c41331ab..922fc9024d 100644--- a/backend/src/server/routes/v1/identity-org-membership-router.ts+++ b/backend/src/server/routes/v1/identity-org-membership-router.ts@@ -317,7 +317,15 @@ export const registerIdentityOrgMembershipRouter = async (server: FastifyZodProvtemporaryAccessEndTime: z.date().nullable().optional()})),- identity: IdentitiesSchema.pick({ name: true, id: true, orgId: true, projectId: true })+ identity: IdentitiesSchema.pick({+ name: true,+ id: true,+ orgId: true,+ projectId: true+ }).extend({+ authMethods: z.array(z.string()),+ activeLockoutAuthMethods: z.array(z.string())+ })}).array(),totalCount: z.number()diff --git a/backend/src/server/routes/v1/identity-project-membership-router.ts b/backend/src/server/routes/v1/identity-project-membership-router.tsindex 194f0c5c0e..6ee08d36cc 100644--- a/backend/src/server/routes/v1/identity-project-membership-router.ts+++ b/backend/src/server/routes/v1/identity-project-membership-router.ts@@ -330,7 +330,15 @@ export const registerIdentityProjectMembershipRouter = async (server: FastifyZodtemporaryAccessEndTime: z.date().nullable().optional()})),- identity: IdentitiesSchema.pick({ name: true, id: true, orgId: true, projectId: true })+ identity: IdentitiesSchema.pick({+ name: true,+ id: true,+ orgId: true,+ projectId: true+ }).extend({+ authMethods: z.array(z.string()),+ activeLockoutAuthMethods: z.array(z.string())+ })}).array(),totalCount: z.number()diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.tsindex fe15a192cc..99cc1f906c 100644--- a/backend/src/server/routes/v1/identity-router.ts+++ b/backend/src/server/routes/v1/identity-router.ts@@ -435,7 +435,8 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {description: true}).optional(),identity: IdentitiesSchema.pick({ name: true, id: true, hasDeleteProtection: true, orgId: true }).extend({- authMethods: z.array(z.string())+ authMethods: z.array(z.string()),+ activeLockoutAuthMethods: z.array(z.string())})}).array(),totalCount: z.number()diff --git a/backend/src/services/identity/identity-service.ts b/backend/src/services/identity/identity-service.tsindex 5bfd9b8f15..a00a686497 100644--- a/backend/src/services/identity/identity-service.ts+++ b/backend/src/services/identity/identity-service.ts@@ -479,7 +479,17 @@ export const identityServiceFactory = ({searchFilter});- return { identityMemberships: docs, totalCount };+ const docsWithLockouts = await Promise.all(+ docs.map(async (doc) => ({+ ...doc,+ identity: {+ ...doc.identity,+ activeLockoutAuthMethods: await getIdentityActiveLockoutAuthMethods(doc.identity.id, keyStore)+ }+ }))+ );++ return { identityMemberships: docsWithLockouts, totalCount };};const listProjectIdentitiesByIdentityId = async ({diff --git a/backend/src/services/membership-identity/membership-identity-dal.ts b/backend/src/services/membership-identity/membership-identity-dal.tsindex 58f8215775..f50ebffa8b 100644--- a/backend/src/services/membership-identity/membership-identity-dal.ts+++ b/backend/src/services/membership-identity/membership-identity-dal.ts@@ -285,6 +285,39 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {.join(TableName.Identity, `${TableName.Identity}.id`, `${TableName.Membership}.actorIdentityId`).join(TableName.MembershipRole, `${TableName.Membership}.id`, `${TableName.MembershipRole}.membershipId`).leftJoin(TableName.Role, `${TableName.MembershipRole}.customRoleId`, `${TableName.Role}.id`)+ .leftJoin(+ TableName.IdentityUniversalAuth,+ `${TableName.Identity}.id`,+ `${TableName.IdentityUniversalAuth}.identityId`+ )+ .leftJoin(TableName.IdentityGcpAuth, `${TableName.Identity}.id`, `${TableName.IdentityGcpAuth}.identityId`)+ .leftJoin(+ TableName.IdentityAliCloudAuth,+ `${TableName.Identity}.id`,+ `${TableName.IdentityAliCloudAuth}.identityId`+ )+ .leftJoin(TableName.IdentityAwsAuth, `${TableName.Identity}.id`, `${TableName.IdentityAwsAuth}.identityId`)+ .leftJoin(+ TableName.IdentityKubernetesAuth,+ `${TableName.Identity}.id`,+ `${TableName.IdentityKubernetesAuth}.identityId`+ )+ .leftJoin(TableName.IdentityOciAuth, `${TableName.Identity}.id`, `${TableName.IdentityOciAuth}.identityId`)+ .leftJoin(TableName.IdentityOidcAuth, `${TableName.Identity}.id`, `${TableName.IdentityOidcAuth}.identityId`)+ .leftJoin(TableName.IdentityAzureAuth, `${TableName.Identity}.id`, `${TableName.IdentityAzureAuth}.identityId`)+ .leftJoin(TableName.IdentityTokenAuth, `${TableName.Identity}.id`, `${TableName.IdentityTokenAuth}.identityId`)+ .leftJoin(+ TableName.IdentityTlsCertAuth,+ `${TableName.Identity}.id`,+ `${TableName.IdentityTlsCertAuth}.identityId`+ )+ .leftJoin(TableName.IdentityLdapAuth, `${TableName.Identity}.id`, `${TableName.IdentityLdapAuth}.identityId`)+ .leftJoin(TableName.IdentityJwtAuth, `${TableName.Identity}.id`, `${TableName.IdentityJwtAuth}.identityId`)+ .leftJoin(+ TableName.IdentitySpiffeAuth,+ `${TableName.Identity}.id`,+ `${TableName.IdentitySpiffeAuth}.identityId`+ ).distinct(`${TableName.Membership}.id`).where(`${TableName.Membership}.scopeOrgId`, scopeData.orgId).whereIn(`${TableName.Membership}.id`, paginatedIdentitys)@@ -312,7 +345,20 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {.withSchema(TableName.MembershipRole).as("membershipRoleTemporaryAccessEndTime"),db.ref("createdAt").withSchema(TableName.MembershipRole).as("membershipRoleCreatedAt"),- db.ref("updatedAt").withSchema(TableName.MembershipRole).as("membershipRoleUpdatedAt")+ db.ref("updatedAt").withSchema(TableName.MembershipRole).as("membershipRoleUpdatedAt"),+ db.ref("id").as("uaId").withSchema(TableName.IdentityUniversalAuth),+ db.ref("id").as("gcpId").withSchema(TableName.IdentityGcpAuth),+ db.ref("id").as("alicloudId").withSchema(TableName.IdentityAliCloudAuth),+ db.ref("id").as("awsId").withSchema(TableName.IdentityAwsAuth),+ db.ref("id").as("kubernetesId").withSchema(TableName.IdentityKubernetesAuth),+ db.ref("id").as("ociId").withSchema(TableName.IdentityOciAuth),+ db.ref("id").as("oidcId").withSchema(TableName.IdentityOidcAuth),+ db.ref("id").as("azureId").withSchema(TableName.IdentityAzureAuth),+ db.ref("id").as("tokenId").withSchema(TableName.IdentityTokenAuth),+ db.ref("id").as("jwtId").withSchema(TableName.IdentityJwtAuth),+ db.ref("id").as("ldapId").withSchema(TableName.IdentityLdapAuth),+ db.ref("id").as("tlsCertId").withSchema(TableName.IdentityTlsCertAuth),+ db.ref("id").as("spiffeId").withSchema(TableName.IdentitySpiffeAuth));const data = sqlNestRelationships({@@ -324,7 +370,20 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {identityHasDeleteProtection,identityName,identityProjectId,- identityOrgId+ identityOrgId,+ uaId,+ gcpId,+ alicloudId,+ awsId,+ kubernetesId,+ ociId,+ oidcId,+ azureId,+ tokenId,+ jwtId,+ ldapId,+ tlsCertId,+ spiffeId} = el;return {...MembershipsSchema.parse(el),@@ -334,7 +393,22 @@ export const membershipIdentityDALFactory = (db: TDbClient) => {id: actorIdentityId,hasDeleteProtection: identityHasDeleteProtection,orgId: identityOrgId,- projectId: identityProjectId+ projectId: identityProjectId,+ authMethods: buildAuthMethods({+ uaId,+ gcpId,+ alicloudId,+ awsId,+ kubernetesId,+ ociId,+ oidcId,+ azureId,+ tokenId,+ jwtId,+ ldapId,+ tlsCertId,+ spiffeId+ })}};},diff --git a/backend/src/services/membership-identity/membership-identity-service.ts b/backend/src/services/membership-identity/membership-identity-service.tsindex 2d20ba3d42..4846cc3676 100644--- a/backend/src/services/membership-identity/membership-identity-service.ts+++ b/backend/src/services/membership-identity/membership-identity-service.ts@@ -3,10 +3,12 @@ import { Knex } from "knex";import { AccessScope, ProjectMembershipRole, TemporaryPermissionMode, TMembershipRolesInsert } from "@app/db/schemas";import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";+import { TKeyStoreFactory } from "@app/keystore/keystore";import { BadRequestError, NotFoundError } from "@app/lib/errors";import { groupBy } from "@app/lib/fn";import { ms } from "@app/lib/ms";import { SearchResourceOperators } from "@app/lib/search-resource/search";+import { getIdentityActiveLockoutAuthMethods } from "@app/services/identity-v2/identity-fns";import { TAdditionalPrivilegeDALFactory } from "../additional-privilege/additional-privilege-dal";import { TIdentityDALFactory } from "../identity/identity-dal";@@ -36,6 +38,7 @@ type TMembershipIdentityServiceFactoryDep = {additionalPrivilegeDAL: Pick<TAdditionalPrivilegeDALFactory, "delete">;identityDAL: Pick<TIdentityDALFactory, "findById">;licenseService: Pick<TLicenseServiceFactory, "getPlan">;+ keyStore: Pick<TKeyStoreFactory, "getKeysByPattern" | "getItem">;};export type TMembershipIdentityServiceFactory = ReturnType<typeof membershipIdentityServiceFactory>;@@ -48,7 +51,8 @@ export const membershipIdentityServiceFactory = ({orgDAL,additionalPrivilegeDAL,identityDAL,- licenseService+ licenseService,+ keyStore}: TMembershipIdentityServiceFactoryDep) => {const scopeFactory = {[AccessScope.Organization]: newOrgMembershipIdentityFactory({@@ -353,7 +357,17 @@ export const membershipIdentityServiceFactory = ({: undefined}});- return { ...memberships, data: memberships.data.filter((el) => listFilter({ identityId: el.identity.id })) };+ const filtered = memberships.data.filter((el) => listFilter({ identityId: el.identity.id }));+ const withLockouts = await Promise.all(+ filtered.map(async (el) => ({+ ...el,+ identity: {+ ...el.identity,+ activeLockoutAuthMethods: await getIdentityActiveLockoutAuthMethods(el.identity.id, keyStore)+ }+ }))+ );+ return { ...memberships, data: withLockouts };};const getMembershipByIdentityId = async (dto: TGetMembershipIdentityByIdentityIdDTO) => {diff --git a/frontend/src/components/v3/generic/Dropdown/Dropdown.tsx b/frontend/src/components/v3/generic/Dropdown/Dropdown.tsxindex 6555a5701a..1b65f94299 100644--- a/frontend/src/components/v3/generic/Dropdown/Dropdown.tsx+++ b/frontend/src/components/v3/generic/Dropdown/Dropdown.tsx@@ -2,7 +2,7 @@import * as React from "react";import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";-import { CheckIcon, ChevronRightIcon } from "lucide-react";+import { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";import { cn } from "@app/components/v3/utils";@@ -193,9 +193,11 @@ function DropdownMenuSubTrigger({className,inset,children,+ chevronOnLeft = false,...props}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {inset?: boolean;+ chevronOnLeft?: boolean;}) {return (<DropdownMenuPrimitive.SubTrigger@@ -207,8 +209,9 @@ function DropdownMenuSubTrigger({)}{...props}>+ {chevronOnLeft && <ChevronLeftIcon className="size-4" />}{children}- <ChevronRightIcon className="ml-auto size-4" />+ {!chevronOnLeft && <ChevronRightIcon className="ml-auto size-4" />}</DropdownMenuPrimitive.SubTrigger>);}diff --git a/frontend/src/components/v3/generic/Tabs/Tabs.tsx b/frontend/src/components/v3/generic/Tabs/Tabs.tsxindex 1786412ba0..643941979e 100644--- a/frontend/src/components/v3/generic/Tabs/Tabs.tsx+++ b/frontend/src/components/v3/generic/Tabs/Tabs.tsx@@ -28,12 +28,12 @@ const tabsListVariants = cva(variant: {filled: "border p-1 border-border",project:- "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2",- org: "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2",+ "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:w-full group-data-[orientation=horizontal]/tabs:justify-start group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2",+ org: "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:w-full group-data-[orientation=horizontal]/tabs:justify-start group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2","sub-org":- "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2",+ "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:w-full group-data-[orientation=horizontal]/tabs:justify-start group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2",admin:- "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2"+ "bg-transparent group-data-[orientation=horizontal]/tabs:h-11 group-data-[orientation=horizontal]/tabs:w-full group-data-[orientation=horizontal]/tabs:justify-start group-data-[orientation=horizontal]/tabs:border-b group-data-[orientation=horizontal]/tabs:border-border group-data-[orientation=vertical]/tabs:gap-2"}},defaultVariants: {@@ -79,7 +79,7 @@ function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPr"group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px]","focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50","has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 [&_svg]:pointer-events-none",- "group-data-[style=underline]/tabs-list:bg-transparent [&_svg]:shrink-0",+ "group-data-[style=underline]/tabs-list:bg-transparent group-data-[orientation=horizontal]/tabs:group-data-[style=underline]/tabs-list:flex-none [&_svg]:shrink-0","[&_svg:not([class*='size-'])]:size-4","data-[state=active]:text-foreground","group-data-[style=filled]/tabs-list:data-[state=active]:border-container-hover group-data-[style=filled]/tabs-list:data-[state=active]:bg-container-hover",@@ -103,7 +103,7 @@ function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrreturn (<TabsPrimitive.Contentdata-slot="tabs-content"- className={cn("flex-1 text-sm text-foreground outline-none", className)}+ className={cn("mt-3 flex-1 text-sm text-foreground outline-none", className)}{...props}/>);diff --git a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsxindex 54273fcf68..10942756a5 100644--- a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx+++ b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx@@ -1,15 +1,21 @@-import { faGlobe, faLayerGroup, faServer } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useQuery } from "@tanstack/react-query";-import { twMerge } from "tailwind-merge";+import { GlobeIcon, Layers3Icon, ServerIcon } from "lucide-react";-import { Select, SelectItem, Tooltip } from "@app/components/v2";import { useSubscription } from "@app/context";import { gatewayPoolsQueryKeys } from "@app/hooks/api/gateway-pools/queries";import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";import { isGatewayHealthy } from "@app/hooks/api/gateways-v2/utils";import { PoolHealthBadge } from "@app/pages/organization/NetworkingPage/components/GatewayTab/components/PoolHealthBadge";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from "../../generic/Select";+import { Tooltip, TooltipContent, TooltipTrigger } from "../../generic/Tooltip";+type GatewayPickerValue = {gatewayId: string | null;gatewayPoolId: string | null;@@ -22,14 +28,14 @@ type Props = {className?: string;isRequired?: boolean;placeholder?: string;- variant?: "v2" | "v3";+ isError?: boolean;};const SectionLabel = ({ children }: { children: React.ReactNode }) => (- <div className="px-2 pt-2 pb-1 text-xs text-mineshaft-400">{children}</div>+ <div className="px-2 pt-2 pb-1 text-xs text-muted">{children}</div>);-const SectionDivider = () => <div className="my-1 h-px bg-mineshaft-600" />;+const SectionDivider = () => <div className="my-1 h-px bg-border" />;export const GatewayPicker = ({value,@@ -38,7 +44,7 @@ export const GatewayPicker = ({className,isRequired,placeholder,- variant = "v2"+ isError}: Props) => {const { subscription } = useSubscription();const showPools = subscription?.gatewayPool;@@ -72,95 +78,79 @@ export const GatewayPicker = ({const isOnline = (gw: (typeof v2Gateways)[number]) => isGatewayHealthy(gw);- const itemHoverV3 =- "[&_[data-radix-collection-item]:hover]:bg-foreground/5 [&_[data-radix-collection-item][data-highlighted]]:bg-foreground/5";-return (- <Select- value={selectValue}- onValueChange={handleChange}- isDisabled={isDisabled}- isLoading={Boolean(isLoading)}- containerClassName="contents"- className={twMerge(- "w-full",- variant === "v3" && "h-9 border-border bg-transparent text-foreground",- className- )}- dropdownContainerClassName={twMerge(- "max-w-none",- variant === "v3" && `border-border bg-popover text-foreground ${itemHoverV3}`- )}- position="popper"- side="bottom"- placeholder={placeholder}- >- {!isRequired && (- <SelectItem value="internet">- <div className="flex items-center gap-2">- <FontAwesomeIcon icon={faGlobe} className="size-3.5 text-mineshaft-400" />- Internet Gateway- </div>- </SelectItem>- )}-- {showPools && pools && pools.length > 0 && (- <>- {!isRequired && <SectionDivider />}- <SectionLabel>- <div className="flex items-center justify-between">- <div className="flex items-center gap-2">- <FontAwesomeIcon icon={faLayerGroup} className="size-3" />- Gateway Pools+ <Select value={selectValue} onValueChange={handleChange} disabled={isDisabled || isLoading}>+ <SelectTrigger className={className ?? "w-full"} isError={isError}>+ <SelectValue placeholder={placeholder ?? "Select gateway..."} />+ </SelectTrigger>+ <SelectContent position="popper">+ {!isRequired && (+ <SelectItem value="internet">+ <span className="flex items-center gap-2">+ <GlobeIcon className="size-3.5 text-muted" />+ Internet Gateway+ </span>+ </SelectItem>+ )}++ {showPools && pools && pools.length > 0 && (+ <>+ {!isRequired && <SectionDivider />}+ <SectionLabel>+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <Layers3Icon className="size-3" />+ Gateway Pools+ </div>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="cursor-default rounded bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary">+ HA+ </span>+ </TooltipTrigger>+ <TooltipContent>High Availability</TooltipContent>+ </Tooltip></div>- <Tooltip content="High Availability" className="z-[110]">- <span className="cursor-default rounded bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary">- HA- </span>- </Tooltip>- </div>- </SectionLabel>- {pools.map((pool) => (- <SelectItem value={`pool:${pool.id}`} key={`pool-${pool.id}`}>- <div className="flex min-w-0 items-center gap-2">- <FontAwesomeIcon- icon={faLayerGroup}- className="size-3.5 shrink-0 text-mineshaft-400"- />- <span className="truncate">{pool.name}</span>- <span className="shrink-0 text-xs">- <PoolHealthBadge pool={pool} />+ </SectionLabel>+ {pools.map((pool) => (+ <SelectItem value={`pool:${pool.id}`} key={`pool-${pool.id}`}>+ <span className="flex min-w-0 items-center gap-2">+ <Layers3Icon className="size-3.5 shrink-0 text-muted" />+ <span className="truncate">{pool.name}</span>+ <span className="shrink-0 text-xs">+ <PoolHealthBadge pool={pool} />+ </span></span>+ </SelectItem>+ ))}+ </>+ )}++ {v2Gateways.length > 0 && (+ <>+ {(!isRequired || (showPools && pools && pools.length > 0)) && <SectionDivider />}+ <SectionLabel>+ <div className="flex items-center gap-2">+ <ServerIcon className="size-3" />+ Individual Gateways</div>- </SelectItem>- ))}- </>- )}-- {v2Gateways.length > 0 && (- <>- {(!isRequired || (showPools && pools && pools.length > 0)) && <SectionDivider />}- <SectionLabel>- <div className="flex items-center gap-2">- <FontAwesomeIcon icon={faServer} className="size-3" />- Individual Gateways- </div>- </SectionLabel>- {v2Gateways.map((gw) => (- <SelectItem value={`gateway:${gw.id}`} key={`gw-${gw.id}`}>- <div className="flex min-w-0 items-center gap-2">- <FontAwesomeIcon icon={faServer} className="size-3.5 shrink-0 text-mineshaft-400" />- <span className="truncate">{gw.name}</span>- <span- className={`shrink-0 text-xs ${isOnline(gw) ? "text-green-500" : "text-red-400"}`}- >- {isOnline(gw) ? "Online" : "Offline"}+ </SectionLabel>+ {v2Gateways.map((gw) => (+ <SelectItem value={`gateway:${gw.id}`} key={`gw-${gw.id}`}>+ <span className="flex min-w-0 items-center gap-2">+ <ServerIcon className="size-3.5 shrink-0 text-muted" />+ <span className="truncate">{gw.name}</span>+ <span+ className={`shrink-0 text-xs ${isOnline(gw) ? "text-green-500" : "text-red-400"}`}+ >+ {isOnline(gw) ? "Online" : "Offline"}+ </span></span>- </div>- </SelectItem>- ))}- </>- )}+ </SelectItem>+ ))}+ </>+ )}+ </SelectContent></Select>);};diff --git a/frontend/src/components/v3/platform/PageLoader/PageLoader.tsx b/frontend/src/components/v3/platform/PageLoader/PageLoader.tsxindex 31fcb26392..9cc97925cb 100644--- a/frontend/src/components/v3/platform/PageLoader/PageLoader.tsx+++ b/frontend/src/components/v3/platform/PageLoader/PageLoader.tsx@@ -9,7 +9,11 @@ type PageLoaderProps = {export function PageLoader({ lottieClassName }: PageLoaderProps) {return (<div className="flex h-full w-full items-center justify-center">- <Lottie icon="infisical_loading" isAutoPlay className={twMerge("w-24", lottieClassName)} />+ <Lottie+ icon="infisical_loading_white"+ isAutoPlay+ className={twMerge("w-24", lottieClassName)}+ /></div>);}diff --git a/frontend/src/hooks/api/identities/mutations.tsx b/frontend/src/hooks/api/identities/mutations.tsxindex 9f2163c4da..7fdeba7e52 100644--- a/frontend/src/hooks/api/identities/mutations.tsx+++ b/frontend/src/hooks/api/identities/mutations.tsx@@ -272,6 +272,11 @@ export const useClearIdentityUniversalAuthLockouts = () => {queryClient.invalidateQueries({queryKey: identitiesKeys.getIdentityUniversalAuth(identityId)});+ queryClient.invalidateQueries({ queryKey: identitiesKeys.searchIdentitiesRoot });+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });+ queryClient.invalidateQueries({+ predicate: (q) => q.queryKey.includes("project-identity-memberships")+ });}});};@@ -2000,6 +2005,11 @@ export const useClearIdentityLdapAuthLockouts = () => {queryClient.invalidateQueries({queryKey: identitiesKeys.getIdentityLdapAuth(identityId)});+ queryClient.invalidateQueries({ queryKey: identitiesKeys.searchIdentitiesRoot });+ queryClient.invalidateQueries({ queryKey: identitiesKeys.getIdentityById(identityId) });+ queryClient.invalidateQueries({+ predicate: (q) => q.queryKey.includes("project-identity-memberships")+ });}});};diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.tsindex fcb586cf5e..cde4250a6e 100644--- a/frontend/src/hooks/api/identities/types.ts+++ b/frontend/src/hooks/api/identities/types.ts@@ -1017,5 +1017,6 @@ export type IdentityMembershipSearchResult = {roles: IdentityMembershipSearchRole[];identity: Pick<Identity, "id" | "name" | "hasDeleteProtection" | "orgId"> & {authMethods: IdentityAuthMethod[];+ activeLockoutAuthMethods: IdentityAuthMethod[];};};diff --git a/frontend/src/hooks/index.ts b/frontend/src/hooks/index.tsindex c8e838e06a..87e6313572 100644--- a/frontend/src/hooks/index.ts+++ b/frontend/src/hooks/index.ts@@ -11,6 +11,7 @@ export { usePersistentState } from "./usePersistentState";export { usePopUp } from "./usePopUp";export { useResetPageHelper } from "./useResetPageHelper";export * from "./useResizableHeaderHeight";+export { useScopeVariant } from "./useScopeVariant";export { useSyntaxHighlight } from "./useSyntaxHighlight";export { useTimedReset } from "./useTimedReset";export { useToggle } from "./useToggle";diff --git a/frontend/src/hooks/useScopeVariant.ts b/frontend/src/hooks/useScopeVariant.tsnew file mode 100644index 0000000000..bf5c972ae7--- /dev/null+++ b/frontend/src/hooks/useScopeVariant.ts@@ -0,0 +1,19 @@+import { useParams } from "@tanstack/react-router";++import { useOrganization } from "@app/context";++export type ScopeVariant = "org" | "project" | "sub-org";++/**+ * Returns the scope-coloured variant ("org" | "project" | "sub-org") to pass to+ * v3 components (Button, TabsList, IconButton, etc.) so they match the+ * surrounding page chrome.+ */+export const useScopeVariant = (): ScopeVariant => {+ const { projectId } = useParams({ strict: false });+ const { isSubOrganization } = useOrganization();++ if (projectId) return "project";+ if (isSubOrganization) return "sub-org";+ return "org";+};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAliCloudAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAliCloudAuthForm.tsxindex 9e9cf6dcbb..3e22c3d9a9 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAliCloudAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAliCloudAuthForm.tsx@@ -1,25 +1,32 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityAliCloudAuth,useGetIdentityAliCloudAuth,@@ -28,7 +35,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -60,6 +67,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityAliCloudAuthForm = ({@@ -67,7 +75,8 @@ export const IdentityAliCloudAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -75,6 +84,7 @@ export const IdentityAliCloudAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityAliCloudAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityAliCloudAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -135,6 +145,10 @@ export const IdentityAliCloudAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({allowedArns,accessTokenTTL,@@ -176,8 +190,11 @@ export const IdentityAliCloudAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -187,170 +204,185 @@ export const IdentityAliCloudAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="allowedArns"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed ARNs"- isRequired- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- placeholder="acs:ram::0000000000000000:user/user1, acs:ram::0000000000000000:user/user2, ..."- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ name="allowedArns"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedArns">Allowed ARNs</FieldLabel>+ <Input+ {...field}+ id="allowedArns"+ placeholder="acs:ram::0000000000000000:user/user1, acs:ram::0000000000000000:user/user2, ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsxindex a5f2357dd1..6fa90deb8b 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx@@ -1,10 +1,20 @@import { useState } from "react";+import { useParams } from "@tanstack/react-router";-import { Modal, ModalContent } from "@app/components/v2";-import { IdentityAuthMethod, identityAuthToNameMap } from "@app/hooks/api/identities";+import {+ Button,+ Sheet,+ SheetContent,+ SheetFooter,+ SheetHeader,+ SheetTitle+} from "@app/components/v3";+import { useOrganization } from "@app/context";+import { IdentityAuthMethod } from "@app/hooks/api/identities";import { UsePopUpState } from "@app/hooks/usePopUp";import { IdentityAuthMethodModalContent } from "./IdentityAuthMethodModalContent";+import { IDENTITY_AUTH_FORM_ID } from "./types";type Props = {popUp: UsePopUpState<["identityAuthMethod", "upgradePlan"]>;@@ -17,39 +27,69 @@ type Props = {export const IdentityAuthMethodModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Props) => {const [selectedAuthMethod, setSelectedAuthMethod] = useState<IdentityAuthMethod | null>(null);+ const [isSubmitting, setIsSubmitting] = useState(false);++ const { projectId } = useParams({ strict: false });+ const { isSubOrganization } = useOrganization();++ // eslint-disable-next-line no-nested-ternary+ const primaryVariant = projectId ? "project" : isSubOrganization ? "sub-org" : "org";const initialAuthMethod = popUp?.identityAuthMethod?.data?.authMethod;const isSelectedAuthAlreadyConfigured =popUp?.identityAuthMethod?.data?.allAuthMethods?.includes(selectedAuthMethod);+ const title = isSelectedAuthAlreadyConfigured ? "Edit Auth Method" : "Add Auth Method";+return (- <Modal- isOpen={popUp?.identityAuthMethod?.isOpen}+ <Sheet+ open={popUp?.identityAuthMethod?.isOpen}onOpenChange={(isOpen) => {handlePopUpToggle("identityAuthMethod", isOpen);+ if (!isOpen) setIsSubmitting(false);}}>- <ModalContent- title={- isSelectedAuthAlreadyConfigured- ? `Edit ${identityAuthToNameMap[selectedAuthMethod!] ?? ""}`- : `Add ${identityAuthToNameMap[selectedAuthMethod!] ?? ""}`- }- >- <IdentityAuthMethodModalContent- popUp={popUp}- handlePopUpOpen={handlePopUpOpen}- handlePopUpToggle={handlePopUpToggle}- identity={{- name: popUp?.identityAuthMethod?.data?.name,- authMethods: popUp?.identityAuthMethod?.data?.allAuthMethods,- id: popUp?.identityAuthMethod.data?.identityId- }}- initialAuthMethod={initialAuthMethod}- setSelectedAuthMethod={setSelectedAuthMethod}- />- </ModalContent>- </Modal>+ <SheetContent side="right" className="flex flex-col gap-0 sm:max-w-lg">+ <SheetHeader className="border-b">+ <SheetTitle>{title}</SheetTitle>+ </SheetHeader>+ <div className="thin-scrollbar flex-1 overflow-y-auto p-4">+ <IdentityAuthMethodModalContent+ popUp={popUp}+ handlePopUpOpen={handlePopUpOpen}+ handlePopUpToggle={handlePopUpToggle}+ identity={{+ name: popUp?.identityAuthMethod?.data?.name,+ authMethods: popUp?.identityAuthMethod?.data?.allAuthMethods,+ id: popUp?.identityAuthMethod.data?.identityId+ }}+ initialAuthMethod={initialAuthMethod}+ setSelectedAuthMethod={setSelectedAuthMethod}+ isUpdate={Boolean(isSelectedAuthAlreadyConfigured)}+ onSubmittingChange={setIsSubmitting}+ />+ </div>+ <SheetFooter className="border-t">+ <Button+ type="submit"+ form={IDENTITY_AUTH_FORM_ID}+ variant={primaryVariant}+ isPending={isSubmitting}+ isDisabled={isSubmitting || !selectedAuthMethod}+ >+ {isSelectedAuthAlreadyConfigured ? "Update" : "Add"}+ </Button>+ <Button+ type="button"+ variant="ghost"+ isDisabled={isSubmitting}+ onClick={() => handlePopUpToggle("identityAuthMethod", false)}+ >+ Cancel+ </Button>+ </SheetFooter>+ </SheetContent>+ </Sheet>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsxindex 1c465895c5..98304b4a53 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx@@ -4,8 +4,20 @@ import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";-import { FormControl, Select, SelectItem, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Field,+ FieldError,+ FieldLabel,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { MAX_IDENTITY_ACCESS_TOKEN_TTL_FALLBACK } from "@app/helpers/identityAuthSchemas";import { IdentityAuthMethod } from "@app/hooks/api/identities";import { useFetchServerStatus } from "@app/hooks/api/serverDetails";@@ -40,6 +52,8 @@ type Props = {};initialAuthMethod: IdentityAuthMethod;setSelectedAuthMethod: (authMethod: IdentityAuthMethod) => void;+ isUpdate: boolean;+ onSubmittingChange: (isSubmitting: boolean) => void;};type TRevokeMethods = {@@ -79,7 +93,9 @@ export const IdentityAuthMethodModalContent = ({handlePopUpToggle,identity,initialAuthMethod,- setSelectedAuthMethod+ setSelectedAuthMethod,+ isUpdate,+ onSubmittingChange}: Props) => {const { control, watch } = useForm<FormData>({resolver: zodResolver(schema),@@ -132,6 +148,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -142,6 +160,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -153,6 +173,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -164,6 +186,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -175,6 +199,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -186,6 +212,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -197,6 +225,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -208,6 +238,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -219,6 +251,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -230,6 +264,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -241,6 +277,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -252,6 +290,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)},@@ -263,6 +303,8 @@ export const IdentityAuthMethodModalContent = ({handlePopUpOpen={handlePopUpOpen}handlePopUpToggle={handlePopUpToggle}maxAccessTokenTTL={maxAccessTokenTTL}+ isUpdate={isUpdate}+ onSubmittingChange={onSubmittingChange}/>)}@@ -280,43 +322,54 @@ export const IdentityAuthMethodModalContent = ({control={control}name="authMethod"defaultValue={IdentityAuthMethod.UNIVERSAL_AUTH}- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl label="Auth Method" errorText={error?.message} isError={Boolean(error)}>+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field className="mb-2">+ <FieldLabel htmlFor="auth-method">Auth Method</FieldLabel><Select- isDisabled={isSelectedAuthAlreadyConfigured}- defaultValue={field.value}- {...field}- onValueChange={(e) => {- if (!isAlreadyConfigured(e as IdentityAuthMethod)) {- setSelectedAuthMethod(e as IdentityAuthMethod);- onChange(e);+ value={value}+ disabled={isSelectedAuthAlreadyConfigured}+ onValueChange={(next) => {+ if (!isAlreadyConfigured(next as IdentityAuthMethod)) {+ setSelectedAuthMethod(next as IdentityAuthMethod);+ onChange(next);}}}- className="w-full">- {identityAuthMethods.map(({ label, value }) => {- const alreadyConfigured = isAlreadyConfigured(value);- return (- <Tooltip- key={`auth-method-${value}`}- content="Authentication method already configured"- isDisabled={!alreadyConfigured}- >+ <SelectTrigger id="auth-method" className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select auth method" />+ </SelectTrigger>+ <SelectContent position="popper">+ {identityAuthMethods.map(({ label, value: methodValue }) => {+ const alreadyConfigured = isAlreadyConfigured(methodValue);+ const item = (<SelectItem- isDisabled={alreadyConfigured}- value={String(value || "")}key={label}+ disabled={alreadyConfigured}+ value={String(methodValue || "")}>- {label}{" "}- {alreadyConfigured && !isSelectedAuthAlreadyConfigured && (- <Badge variant="info">Configured</Badge>- )}+ <span className="flex items-center gap-2">+ {label}+ {alreadyConfigured && !isSelectedAuthAlreadyConfigured && (+ <Badge variant="info">Configured</Badge>+ )}+ </span></SelectItem>- </Tooltip>- );- })}+ );+ return alreadyConfigured ? (+ <Tooltip key={`auth-method-${methodValue}`}>+ <TooltipTrigger asChild>{item}</TooltipTrigger>+ <TooltipContent side="right">+ Authentication method already configured+ </TooltipContent>+ </Tooltip>+ ) : (+ item+ );+ })}+ </SelectContent></Select>- </FormControl>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>{selectedMethodItem?.render ? selectedMethodItem.render() : <div />}diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAwsAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAwsAuthForm.tsxindex a98ac666fd..15f860d1f1 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAwsAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAwsAuthForm.tsx@@ -1,25 +1,32 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityAwsAuth,useGetIdentityAwsAuth,@@ -28,7 +35,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -62,6 +69,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityAwsAuthForm = ({@@ -69,7 +77,8 @@ export const IdentityAwsAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -77,6 +86,7 @@ export const IdentityAwsAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityAwsAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityAwsAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -143,6 +153,10 @@ export const IdentityAwsAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({allowedPrincipalArns,allowedAccountIds,@@ -188,8 +202,11 @@ export const IdentityAwsAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -199,194 +216,221 @@ export const IdentityAwsAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- defaultValue="2592000"- name="allowedPrincipalArns"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Principal ARNs"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- placeholder="arn:aws:iam::123456789012:role/MyRoleName, arn:aws:iam::123456789012:user/MyUserName..."- type="text"- />- </FormControl>- )}- />- <Controller- control={control}- name="allowedAccountIds"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Account IDs"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="123456789012, ..." />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="https://sts.amazonaws.com/"- name="stsEndpoint"- render={({ field, fieldState: { error } }) => (- <FormControl label="STS Endpoint" isError={Boolean(error)} errorText={error?.message}>- <Input {...field} placeholder="https://sts.amazonaws.com/" type="text" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ defaultValue="2592000"+ name="allowedPrincipalArns"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedPrincipalArns">Allowed Principal ARNs</FieldLabel>+ <Input+ {...field}+ id="allowedPrincipalArns"+ placeholder="arn:aws:iam::123456789012:role/MyRoleName, arn:aws:iam::123456789012:user/MyUserName..."+ type="text"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="allowedAccountIds"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedAccountIds">Allowed Account IDs</FieldLabel>+ <Input+ {...field}+ id="allowedAccountIds"+ placeholder="123456789012, ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="https://sts.amazonaws.com/"+ name="stsEndpoint"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="stsEndpoint">STS Endpoint</FieldLabel>+ <Input+ {...field}+ id="stsEndpoint"+ placeholder="https://sts.amazonaws.com/"+ type="text"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAzureAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAzureAuthForm.tsxindex 370c236881..4fdf926515 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAzureAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAzureAuthForm.tsx@@ -1,25 +1,32 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityAzureAuth,useGetIdentityAzureAuth,@@ -28,7 +35,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -63,6 +70,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityAzureAuthForm = ({@@ -70,7 +78,8 @@ export const IdentityAzureAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -78,6 +87,7 @@ export const IdentityAzureAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityAzureAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityAzureAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -145,6 +155,10 @@ export const IdentityAzureAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({tenantId,resource,@@ -192,8 +206,11 @@ export const IdentityAzureAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -203,194 +220,221 @@ export const IdentityAzureAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- defaultValue="2592000"- name="tenantId"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Tenant ID"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Input {...field} placeholder="00000000-0000-0000-0000-000000000000" type="text" />- </FormControl>- )}- />- <Controller- control={control}- name="resource"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Resource / Audience"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="https://management.azure.com/" />- </FormControl>- )}- />- <Controller- control={control}- name="allowedServicePrincipalIds"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Service Principal IDs"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="00000000-0000-0000-0000-000000000000, ..." />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ defaultValue="2592000"+ name="tenantId"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="tenantId">Tenant ID</FieldLabel>+ <Input+ {...field}+ id="tenantId"+ placeholder="00000000-0000-0000-0000-000000000000"+ type="text"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="resource"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="resource">Resource / Audience</FieldLabel>+ <Input+ {...field}+ id="resource"+ placeholder="https://management.azure.com/"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="allowedServicePrincipalIds"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedServicePrincipalIds">+ Allowed Service Principal IDs+ </FieldLabel>+ <Input+ {...field}+ id="allowedServicePrincipalIds"+ placeholder="00000000-0000-0000-0000-000000000000, ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsxindex 88e0033178..b241f55a4a 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm.tsx@@ -1,27 +1,37 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,Select,+ SelectContent,SelectItem,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ SelectTrigger,+ SelectValue,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityGcpAuth,useGetIdentityGcpAuth,@@ -30,7 +40,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -66,6 +76,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityGcpAuthForm = ({@@ -73,7 +84,8 @@ export const IdentityGcpAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -81,6 +93,7 @@ export const IdentityGcpAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityGcpAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityGcpAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -153,6 +166,10 @@ export const IdentityGcpAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({type,allowedServiceAccounts,@@ -202,8 +219,11 @@ export const IdentityGcpAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -213,222 +233,248 @@ export const IdentityGcpAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="type"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl label="Type" isError={Boolean(error)} errorText={error?.message}>- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => onChange(e)}- className="w-full"- >- <SelectItem value="gce" key="gce">- GCP ID Token Auth (Recommended)- </SelectItem>- <SelectItem value="iam" key="iam">- GCP IAM Auth- </SelectItem>- </Select>- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="allowedServiceAccounts"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Service Account Emails"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- placeholder="[email protected], [email protected]"- type="text"- />- </FormControl>- )}- />- {watchedType === "gce" && (+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup><Controllercontrol={control}- name="allowedProjects"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Projects"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="my-gcp-project, ..." />- </FormControl>+ name="type"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="gcp-auth-type">Type</FieldLabel>+ <Select value={value} onValueChange={(e) => onChange(e)}>+ <SelectTrigger id="gcp-auth-type" className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select type" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="gce" key="gce">+ GCP ID Token Auth (Recommended)+ </SelectItem>+ <SelectItem value="iam" key="iam">+ GCP IAM Auth+ </SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- {watchedType === "gce" && (<Controllercontrol={control}- name="allowedZones"+ defaultValue="2592000"+ name="allowedServiceAccounts"render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Zones"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="us-west2-a, us-central1-a, ..." />- </FormControl>+ <Field>+ <FieldLabel htmlFor="allowedServiceAccounts">+ Allowed Service Account Emails+ </FieldLabel>+ <Input+ {...field}+ id="allowedServiceAccounts"+ placeholder="[email protected], [email protected]"+ type="text"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>+ {watchedType === "gce" && (+ <Controller+ control={control}+ name="allowedProjects"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedProjects">Allowed Projects</FieldLabel>+ <Input+ {...field}+ id="allowedProjects"+ placeholder="my-gcp-project, ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />)}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>+ {watchedType === "gce" && (<Controllercontrol={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}+ name="allowedZones"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedZones">Allowed Zones</FieldLabel>+ <Input+ {...field}+ id="allowedZones"+ placeholder="us-west2-a, us-central1-a, ..."isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}/>- <IconButton+ )}+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityJwtAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityJwtAuthForm.tsxindex 9941b703ec..2f80997a4e 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityJwtAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityJwtAuthForm.tsx@@ -1,38 +1,46 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { HelpCircleIcon, InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import { BashGlobPatternTooltip } from "@app/components/permissions";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,Select,+ SelectContent,SelectItem,- Tab,- TabList,- TabPanel,+ SelectTrigger,+ SelectValue,Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,TextArea,- Tooltip-} from "@app/components/v2";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import { useAddIdentityJwtAuth, useUpdateIdentityJwtAuth } from "@app/hooks/api";import { IdentityJwtConfigurationType } from "@app/hooks/api/identities/enums";import { useGetIdentityJwtAuth } from "@app/hooks/api/identities/queries";import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) => {const common = z.object({@@ -101,6 +109,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityJwtAuthForm = ({@@ -108,7 +117,8 @@ export const IdentityJwtAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -116,6 +126,7 @@ export const IdentityJwtAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityJwtAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityJwtAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -216,6 +227,10 @@ export const IdentityJwtAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({accessTokenTrustedIps,accessTokenTTL,@@ -279,8 +294,11 @@ export const IdentityJwtAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -290,407 +308,456 @@ export const IdentityJwtAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="configurationType"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Configuration Type"- isError={Boolean(error)}- errorText={error?.message}- >- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => {- if (e === IdentityJwtConfigurationType.JWKS) {- setValue("publicKeys", []);- } else {- setValue("publicKeys", [- {- value: ""+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ name="configurationType"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="configurationType">Configuration Type</FieldLabel>+ <Select+ value={value}+ onValueChange={(e) => {+ if (e === IdentityJwtConfigurationType.JWKS) {+ setValue("publicKeys", []);+ } else {+ setValue("publicKeys", [+ {+ value: ""+ }+ ]);+ setValue("jwksUrl", "");+ setValue("jwksCaCert", "");+ }+ onChange(e);+ }}+ >+ <SelectTrigger+ id="configurationType"+ className="w-full"+ isError={Boolean(error)}+ >+ <SelectValue placeholder="Select configuration type" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value={IdentityJwtConfigurationType.JWKS} key="jwks">+ JWKS+ </SelectItem>+ <SelectItem value={IdentityJwtConfigurationType.STATIC} key="static">+ Static+ </SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ {selectedConfigurationType === IdentityJwtConfigurationType.JWKS && (+ <>+ <Controller+ control={control}+ name="jwksUrl"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="jwksUrl">JWKS URL</FieldLabel>+ <Input {...field} id="jwksUrl" type="text" isError={Boolean(error)} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="jwksCaCert"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="jwksCaCert">JWKS CA Certificate</FieldLabel>+ <TextArea+ {...field}+ id="jwksCaCert"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </>+ )}+ {selectedConfigurationType === IdentityJwtConfigurationType.STATIC && (+ <div className="flex flex-col gap-3">+ {publicKeyFields.map(({ id }, index) => (+ <div key={id} className="flex items-start gap-2">+ <Controller+ control={control}+ name={`publicKeys.${index}.value`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ <FieldLabel+ htmlFor={`publicKey-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Public Key {index + 1}+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="text-center">+ This field only accepts PEM-formatted public keys+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <TextArea+ {...field}+ id={`publicKey-${index}`}+ placeholder="-----BEGIN PUBLIC KEY----- ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove public key"+ className="mt-[1.625rem]"+ onClick={() => {+ if (publicKeyFields.length === 1) {+ createNotification({+ type: "error",+ text: "A public key is required for static configurations"+ });+ return;}- ]);- setValue("jwksUrl", "");- setValue("jwksCaCert", "");- }- onChange(e);- }}- className="w-full"+ removePublicKeyFields(index);+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"+ onClick={() =>+ appendPublicKeyFields({+ value: ""+ })+ }>- <SelectItem value={IdentityJwtConfigurationType.JWKS} key="jwks">- JWKS- </SelectItem>- <SelectItem value={IdentityJwtConfigurationType.STATIC} key="static">- Static- </SelectItem>- </Select>- </FormControl>+ <PlusIcon />+ Add Public Key+ </Button>+ </div>)}- />- {selectedConfigurationType === IdentityJwtConfigurationType.JWKS && (- <>- <Controller- control={control}- name="jwksUrl"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="JWKS URL"+ <Controller+ control={control}+ name="boundIssuer"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundIssuer">Issuer</FieldLabel>+ <Input {...field} id="boundIssuer" type="text" isError={Boolean(error)} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="boundSubject"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundSubject" className="inline-flex items-center gap-1.5">+ Subject+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} id="boundSubject" type="text" isError={Boolean(error)} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="boundAudiences"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundAudiences" className="inline-flex items-center gap-1.5">+ Audiences+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="boundAudiences"+ type="text"+ placeholder="service1, service2"isError={Boolean(error)}- errorText={error?.message}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <div className="flex flex-col gap-3">+ {boundClaimsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`boundClaims.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`boundClaim-key-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Claims+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`boundClaim-key-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="property"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name={`boundClaims.${index}.value`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`boundClaim-value-${index}`} className="invisible">+ Value+ </FieldLabel>+ )}+ <Input+ id={`boundClaim-value-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="value1, value2"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove claim"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => removeBoundClaimField(index)}>- <Input {...field} type="text" />- </FormControl>- )}- />- <Controller- control={control}- name="jwksCaCert"- render={({ field, fieldState: { error } }) => (- <FormControl- label="JWKS CA Certificate"- errorText={error?.message}+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"+ onClick={() =>+ appendBoundClaimField({+ key: "",+ value: ""+ })+ }+ >+ <PlusIcon />+ Add Claims+ </Button>+ </div>+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5">- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />- </FormControl>- )}- />- </>- )}- {selectedConfigurationType === IdentityJwtConfigurationType.STATIC && (- <>- {publicKeyFields.map(({ id }, index) => (- <div key={id} className="flex gap-2">+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}><Controllercontrol={control}- name={`publicKeys.${index}.value`}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"render={({ field, fieldState: { error } }) => (- <FormControl- className="grow"- label={`Public Key ${index + 1}`}- errorText={error?.message}- isError={Boolean(error)}- icon={- <Tooltip- className="text-center"- content={<span>This field only accepts PEM-formatted public keys</span>}- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- }- >- <TextArea {...field} placeholder="-----BEGIN PUBLIC KEY----- ..." />- </FormControl>+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}onClick={() => {- if (publicKeyFields.length === 1) {- createNotification({- type: "error",- text: "A public key is required for static configurations"- });+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);return;}-- removePublicKeyFields(index);+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />+ <XIcon /></IconButton></div>))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() =>- appendPublicKeyFields({- value: ""- })- }- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add Public Key- </Button>- </div>- </>- )}- <Controller- control={control}- name="boundIssuer"- render={({ field, fieldState: { error } }) => (- <FormControl label="Issuer" isError={Boolean(error)} errorText={error?.message}>- <Input {...field} type="text" />- </FormControl>- )}- />- <Controller- control={control}- name="boundSubject"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Subject"- isError={Boolean(error)}- errorText={error?.message}- icon={- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- }- >- <Input {...field} type="text" />- </FormControl>- )}- />- <Controller- control={control}- name="boundAudiences"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Audiences"- isError={Boolean(error)}- errorText={error?.message}- icon={- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- }- >- <Input {...field} type="text" placeholder="service1, service2" />- </FormControl>- )}- />- {boundClaimsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`boundClaims.${index}.key`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Claims" : undefined}- icon={- index === 0 ? (- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- ) : undefined- }- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="property"- />- </FormControl>- );- }}- />- <Controller- control={control}- name={`boundClaims.${index}.value`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="value1, value2"- />- </FormControl>- );- }}- />-- <IconButton- onClick={() => removeBoundClaimField(index)}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3"- >- <FontAwesomeIcon icon={faXmark} />- </IconButton>- </div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() =>- appendBoundClaimField({- key: "",- value: ""- })- }- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add Claims- </Button>- </div>- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Create"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsxindex 1667d7b6be..227bd123b2 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm.tsx@@ -1,29 +1,37 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faInfoCircle, faPlus, faQuestionCircle, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { HelpCircleIcon, InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ GatewayPicker,IconButton,Input,Select,+ SelectContent,SelectItem,+ SelectTrigger,+ SelectValue,Switch,- Tab,- TabList,- TabPanel,Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,TextArea,- Tooltip-} from "@app/components/v2";-import { GatewayPicker } from "@app/components/v3";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import {OrgGatewayPermissionActions,@@ -31,6 +39,7 @@ import {} from "@app/context/OrgPermissionContext/types";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityKubernetesAuth,useGetIdentityKubernetesAuth,@@ -49,7 +58,7 @@ import { VaultKubernetesAuthRole } from "@app/hooks/api/migration/types";import { useCanUseOrgAppConnectionImport } from "@app/hooks/useCanUseAppConnectionImport";import { usePopUp, UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";import { VaultKubernetesAuthImportModal } from "./VaultKubernetesAuthImportModal";const buildSchema = (maxAccessTokenTTL: number) =>@@ -143,6 +152,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityKubernetesAuthForm = ({@@ -150,7 +160,8 @@ export const IdentityKubernetesAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -158,6 +169,7 @@ export const IdentityKubernetesAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityKubernetesAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityKubernetesAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -263,6 +275,10 @@ export const IdentityKubernetesAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const handleImportFromVault = (role: VaultKubernetesAuthRole) => {try {setValue("kubernetesHost", role.config.kubernetes_host, {@@ -429,9 +445,11 @@ export const IdentityKubernetesAuthForm = ({};const tokenReviewMode = watch("tokenReviewMode");+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue([@@ -451,68 +469,62 @@ export const IdentityKubernetesAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- {hasVaultConnection && canUseAppConnectionImport && !isUpdate && (- <div className="mb-4 flex items-center justify-between rounded-md border border-primary/30 bg-primary/10 p-3">- <div className="flex items-start gap-2 text-sm">- <FontAwesomeIcon icon={faInfoCircle} className="mt-0.5 text-primary" />- <span className="text-mineshaft-200">Load values from HashiCorp Vault</span>+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ {hasVaultConnection && canUseAppConnectionImport && !isUpdate && (+ <div className="flex items-center justify-between rounded-md border border-primary/30 bg-primary/10 p-3">+ <div className="flex items-start gap-2 text-sm">+ <InfoIcon className="mt-0.5 size-4 text-primary" />+ <span className="text-foreground">Load values from HashiCorp Vault</span>+ </div>+ <Tooltip>+ <TooltipTrigger asChild>+ <span>+ <Button+ variant="outline"+ size="xs"+ onClick={() => handleImportPopUpToggle("importFromVault", true)}+ isDisabled={!canUseAppConnectionImport}+ >+ <img+ src="/images/integrations/Vault.png"+ alt="HashiCorp Vault"+ className="h-4 w-4"+ />+ Load from Vault+ </Button>+ </span>+ </TooltipTrigger>+ {!canUseAppConnectionImport && (+ <TooltipContent>+ You don't have permission to import configurations from HashiCorp Vault+ </TooltipContent>+ )}+ </Tooltip></div>- <Tooltip- content={- !canUseAppConnectionImport- ? "You don't have permission to import configurations from HashiCorp Vault"- : undefined- }- >- <Button- variant="outline_bg"- size="xs"- leftIcon={- <img- src="/images/integrations/Vault.png"- alt="HashiCorp Vault"- className="h-4 w-4"- />- }- onClick={() => handleImportPopUpToggle("importFromVault", true)}- isDisabled={!canUseAppConnectionImport}- >- Load from Vault- </Button>- </Tooltip>- </div>- )}- <div className="flex w-full items-center gap-2">- <div className="w-full flex-1">- <OrgPermissionCan- I={OrgGatewayPermissionActions.AttachGateways}- a={OrgPermissionSubjects.Gateway}- >- {(isAllowed) => (- <Controller- control={control}- name="gatewayId"- defaultValue=""- render={({ fieldState: { error } }) => {- const gatewayPoolIdVal = watch("gatewayPoolId");- const gatewayIdVal = watch("gatewayId");-- return (- <FormControl- isError={Boolean(error?.message)}- errorText={error?.message}- label="Gateway"- isOptional- >- <Tooltip- isDisabled={isAllowed}- content="Restricted access. You don't have permission to attach gateways to resources."- >+ )}+ <OrgPermissionCan+ I={OrgGatewayPermissionActions.AttachGateways}+ a={OrgPermissionSubjects.Gateway}+ >+ {(isAllowed) => (+ <Controller+ control={control}+ name="gatewayId"+ defaultValue=""+ render={({ fieldState: { error } }) => {+ const gatewayPoolIdVal = watch("gatewayPoolId");+ const gatewayIdVal = watch("gatewayId");++ return (+ <Field>+ <FieldLabel htmlFor="gatewayId">Gateway (optional)</FieldLabel>+ <Tooltip>+ <TooltipTrigger asChild><div><GatewayPickervalue={{@@ -534,407 +546,548 @@ export const IdentityKubernetesAuthForm = ({className="w-full"/></div>- </Tooltip>- </FormControl>- );- }}- />- )}- </OrgPermissionCan>- </div>+ </TooltipTrigger>+ {!isAllowed && (+ <TooltipContent>+ Restricted access. You don't have permission to attach gateways+ to resources.+ </TooltipContent>+ )}+ </Tooltip>+ <FieldError>{error?.message}</FieldError>+ </Field>+ );+ }}+ />+ )}+ </OrgPermissionCan><Controllercontrol={control}name="tokenReviewMode"- render={({ field }) => (- <FormControl- tooltipClassName="max-w-md"- tooltipText="The method of which tokens are reviewed. If you select Gateway as Reviewer, the selected gateway will be used to review tokens with. If this option is enabled, the gateway must be deployed in Kubernetes, and the gateway must have the system:auth-delegator ClusterRole binding."- label="Review Mode"- >+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="tokenReviewMode"+ className="inline-flex items-center gap-1.5"+ >+ Review Mode+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ The method of which tokens are reviewed. If you select Gateway as Reviewer,+ the selected gateway will be used to review tokens with. If this option is+ enabled, the gateway must be deployed in Kubernetes, and the gateway must+ have the system:auth-delegator ClusterRole binding.+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Select value={field.value} onValueChange={field.onChange}>- <SelectItem value="gateway">Gateway as Reviewer</SelectItem>- <SelectItem value="api">Manual Token Reviewer JWT (API)</SelectItem>+ <SelectTrigger id="tokenReviewMode" isError={Boolean(error)}>+ <SelectValue placeholder="Select review mode" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="gateway">Gateway as Reviewer</SelectItem>+ <SelectItem value="api">Manual Token Reviewer JWT (API)</SelectItem>+ </SelectContent></Select>- </FormControl>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- </div>- {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (+ {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (+ <Controller+ control={control}+ defaultValue="2592000"+ name="kubernetesHost"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="kubernetesHost"+ className="inline-flex items-center gap-1.5"+ >+ Kubernetes Host / Base Kubernetes API URL+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The host string, host:port pair, or URL to the base of the Kubernetes API+ server. This can usually be obtained by running 'kubectl+ cluster-info'+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="kubernetesHost"+ placeholder="https://my-example-k8s-api-host.com"+ type="text"+ value={field.value || ""}+ autoComplete="off"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ )}++ {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (+ <Controller+ control={control}+ name="tokenReviewerJwt"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="tokenReviewerJwt"+ className="inline-flex items-center gap-1.5"+ >+ Token Reviewer JWT+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ Optional JWT token for accessing Kubernetes TokenReview API. If provided,+ this long-lived token will be used to validate service account tokens+ during authentication. If omitted, the client's own JWT will be used+ instead, which requires the client to have the system:auth-delegator+ ClusterRole binding.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="tokenReviewerJwt"+ type="password"+ autoComplete="new-password"+ placeholder="eyJhbGciOiJSUzI1NiIs..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ )}<Controllercontrol={control}- defaultValue="2592000"- name="kubernetesHost"+ defaultValue=""+ name="allowedNamespaces"render={({ field, fieldState: { error } }) => (- <FormControl- label="Kubernetes Host / Base Kubernetes API URL "- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The host string, host:port pair, or URL to the base of the Kubernetes API server. This can usually be obtained by running 'kubectl cluster-info'"- isRequired- >+ <Field>+ <FieldLabel+ htmlFor="allowedNamespaces"+ className="inline-flex items-center gap-1.5"+ >+ Allowed Namespaces+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <div className="flex flex-col gap-1">+ <p>+ A comma-separated list of trusted namespaces that service accounts must+ belong to authenticate with Infisical.+ </p>+ <p>+ Regex and Wildcard patterns are supported. Use{" "}+ <span className="font-mono">*</span> to explicitly allow all.+ </p>+ <p className="text-sm">+ Examples: <span className="font-mono">dev-*</span>,{" "}+ <span className="font-mono">staging-*</span>,{" "}+ <span className="font-mono">team-{"{a,b}"}</span>+ </p>+ </div>+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Input{...field}- placeholder="https://my-example-k8s-api-host.com"+ id="allowedNamespaces"+ placeholder="namespaceA, namespaceB, dev-*"type="text"- value={field.value || ""}autoComplete="off"+ isError={Boolean(error)}/>- </FormControl>+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (<Controllercontrol={control}- name="tokenReviewerJwt"+ name="allowedNames"render={({ field, fieldState: { error } }) => (- <FormControl- tooltipClassName="max-w-md"- label="Token Reviewer JWT"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="Optional JWT token for accessing Kubernetes TokenReview API. If provided, this long-lived token will be used to validate service account tokens during authentication. If omitted, the client's own JWT will be used instead, which requires the client to have the system:auth-delegator ClusterRole binding."- >- <Input {...field} placeholder="" type="password" autoComplete="new-password" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="allowedNames" className="inline-flex items-center gap-1.5">+ Allowed Service Account Names+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <div className="flex flex-col gap-1">+ <p>+ An optional comma-separated list of trusted service account names that+ are allowed to authenticate with Infisical. Leave empty to allow any+ service account.+ </p>+ <p>+ Regex and Wildcard patterns are supported. Use{" "}+ <span className="font-mono">*</span> to explicitly allow all.+ </p>+ <p className="text-sm">+ Examples: <span className="font-mono">dev-*</span>,{" "}+ <span className="font-mono">staging-*</span>,{" "}+ <span className="font-mono">team-{"{a,b}"}</span>+ </p>+ </div>+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="allowedNames"+ placeholder="service-account-1-name, sa-*, app-*-prod"+ autoComplete="off"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- <Controller- control={control}- defaultValue=""- name="allowedNamespaces"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Namespaces"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- <div className="flex flex-col gap-1">- <p>- A comma-separated list of trusted namespaces that service accounts must belong- to authenticate with Infisical.- </p>- <p>- Regex and Wildcard patterns are supported. Use{" "}- <span className="font-mono">*</span> to explicitly allow all.- </p>- <p className="text-sm">- Examples: <span className="font-mono">dev-*</span>,{" "}- <span className="font-mono">staging-*</span>,{" "}- <span className="font-mono">team-{"{a,b}"}</span>- </p>- </div>- }- >- <Input- {...field}- placeholder="namespaceA, namespaceB, dev-*"- type="text"- autoComplete="off"- />- </FormControl>- )}- />-- <Controller- control={control}- name="allowedNames"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Service Account Names"- isError={Boolean(error)}- tooltipText={- <div className="flex flex-col gap-1">- <p>- An optional comma-separated list of trusted service account names that are- allowed to authenticate with Infisical. Leave empty to allow any service- account.- </p>- <p>- Regex and Wildcard patterns are supported. Use{" "}- <span className="font-mono">*</span> to explicitly allow all.- </p>- <p className="text-sm">- Examples: <span className="font-mono">dev-*</span>,{" "}- <span className="font-mono">staging-*</span>,{" "}- <span className="font-mono">team-{"{a,b}"}</span>- </p>- </div>- }- errorText={error?.message}- >- <Input- {...field}- placeholder="service-account-1-name, sa-*, app-*-prod"- autoComplete="off"- />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- tooltipText="The lifetime for an acccess token in seconds. This value will be referenced at renewal time."- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- <Controller- control={control}- defaultValue=""- name="allowedAudience"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Audience"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="An optional audience claim that the service account JWT token must have to authenticate with Infisical. Leave empty to allow any audience claim."- >- <Input {...field} placeholder="" type="text" />- </FormControl>- )}- />- {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (- <>- <Controller- control={control}- name="verifyTlsCertificate"- render={({ field: { value, onChange }, fieldState: { error } }) => {- const hasCaCert = Boolean(watch("caCert")?.length);- return (- <FormControl isError={Boolean(error?.message)} errorText={error?.message}>- <Switch- className="bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-green/80"- id="k8s-verify-tls-certificate"- thumbClassName="bg-mineshaft-800"- isChecked={hasCaCert ? true : value}- onCheckedChange={onChange}- isDisabled={hasCaCert}- >- <p className="w-44 text-sm font-normal text-mineshaft-400">- Verify TLS Certificate- <Tooltip- className="max-w-md"- content={- <div className="flex flex-col gap-2">- {hasCaCert ? (- <p>- Verification is always on while a CA certificate is provided. To- disable verification, clear the CA certificate field below.- </p>- ) : (- <>- <p>- When enabled, Infisical validates the Kubernetes API- server's TLS certificate against the CA certificate- provided below.- </p>+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL" className="inline-flex items-center gap-1.5">+ Access Token TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The lifetime for an acccess token in seconds. This value will be referenced+ at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenMaxTTL"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum lifetime for an access token in seconds. This value will be+ referenced at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <Controller+ control={control}+ defaultValue=""+ name="allowedAudience"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="allowedAudience"+ className="inline-flex items-center gap-1.5"+ >+ Allowed Audience+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ An optional audience claim that the service account JWT token must have to+ authenticate with Infisical. Leave empty to allow any audience claim.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="allowedAudience"+ type="text"+ placeholder="https://kubernetes.default.svc"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ {tokenReviewMode === IdentityKubernetesAuthTokenReviewMode.Api && (+ <>+ <Controller+ control={control}+ name="verifyTlsCertificate"+ render={({ field: { value, onChange }, fieldState: { error } }) => {+ const hasCaCert = Boolean(watch("caCert")?.length);+ return (+ <Field>+ <div className="flex items-center gap-2">+ <Switch+ id="k8s-verify-tls-certificate"+ variant={scopeVariant}+ checked={hasCaCert ? true : value}+ onCheckedChange={onChange}+ disabled={hasCaCert}+ />+ <FieldLabel+ htmlFor="k8s-verify-tls-certificate"+ className="mb-0 inline-flex items-center gap-1.5"+ >+ Verify TLS Certificate+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ <div className="flex flex-col gap-2">+ {hasCaCert ? (<p>- Leaving this disabled means any host that responds at the- configured Kubernetes URL will be trusted, regardless of its- certificate. The connection is still over HTTPS, but the API- server's identity is not verified. Only do this for- testing or if you cannot supply a CA certificate.+ Verification is always on while a CA certificate is provided.+ To disable verification, clear the CA certificate field below.</p>- </>- )}- </div>+ ) : (+ <>+ <p>+ When enabled, Infisical validates the Kubernetes API+ server's TLS certificate against the CA certificate+ provided below.+ </p>+ <p>+ Leaving this disabled means any host that responds at the+ configured Kubernetes URL will be trusted, regardless of its+ certificate. The connection is still over HTTPS, but the API+ server's identity is not verified. Only do this for+ testing or if you cannot supply a CA certificate.+ </p>+ </>+ )}+ </div>+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ </div>+ <FieldError>{error?.message}</FieldError>+ </Field>+ );+ }}+ />+ <Controller+ control={control}+ name="caCert"+ render={({ field, fieldState: { error } }) => {+ const verifyTlsCertificate = watch("verifyTlsCertificate");+ return (+ <Field>+ <FieldLabel htmlFor="caCert" className="inline-flex items-center gap-1.5">+ CA Certificate+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ The PEM-encoded CA certificate that issued the Kubernetes API+ server's TLS certificate. Required when TLS certificate+ verification is enabled. Providing a CA certificate forces TLS+ verification on.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <TextArea+ {...field}+ id="caCert"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ onChange={(e) => {+ field.onChange(e);+ if (e.target.value.length > 0 && !verifyTlsCertificate) {+ setValue("verifyTlsCertificate", true, {+ shouldDirty: true,+ shouldValidate: true+ });}+ }}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ );+ }}+ />+ </>+ )}+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`trustedIp-${index}`}+ className="inline-flex items-center gap-1.5">- <FontAwesomeIcon- icon={faQuestionCircle}- size="sm"- className="ml-1 text-mineshaft-400"- />- </Tooltip>- </p>- </Switch>- </FormControl>- );- }}- />- <Controller- control={control}- name="caCert"- render={({ field, fieldState: { error } }) => {- const verifyTlsCertificate = watch("verifyTlsCertificate");- return (- <FormControl- label="CA Certificate"- errorText={error?.message}- isError={Boolean(error)}- isRequired={verifyTlsCertificate}- tooltipClassName="max-w-md"- tooltipText={- <div className="flex flex-col gap-2">- <p>- The PEM-encoded CA certificate that issued the Kubernetes API- server's TLS certificate. Required when TLS certificate- verification is enabled. Providing a CA certificate forces TLS- verification on.- </p>- </div>- }- >- <TextArea- {...field}- placeholder="-----BEGIN CERTIFICATE----- ..."- onChange={(e) => {- field.onChange(e);- if (e.target.value.length > 0 && !verifyTlsCertificate) {- setValue("verifyTlsCertificate", true, {- shouldDirty: true,- shouldValidate: true+ Access Token Trusted IPs+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The IPs or CIDR ranges that access tokens can be used from. By+ default, each token is given the 0.0.0.0/0, allowing usage from any+ network address.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"});- }- }}- />- </FormControl>- );- }}- />- </>- )}- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address."- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div><VaultKubernetesAuthImportModalisOpen={popUp.importFromVault.isOpen}onOpenChange={(isOpen) => handleImportPopUpToggle("importFromVault", isOpen)}diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsxindex 5889cd8219..eb0ba4f7b4 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm.tsx@@ -1,27 +1,35 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faQuestionCircle, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { HelpCircleIcon, InfoIcon, PlusIcon, XIcon } from "lucide-react";import ms from "ms";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,Select,+ SelectContent,SelectItem,- Tab,- TabList,- TabPanel,+ SelectTrigger,+ SelectValue,Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,TextArea,- Tooltip-} from "@app/components/v2";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useOrgPermission, useSubscription } from "@app/context";import {OrgPermissionMachineIdentityAuthTemplateActions,@@ -29,6 +37,7 @@ import {} from "@app/context/OrgPermissionContext/types";import { getObjectFromSeconds, SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {MachineIdentityAuthMethod,useAddIdentityLdapAuth,@@ -41,7 +50,7 @@ import { UsePopUpState } from "@app/hooks/usePopUp";import { LockoutTab } from "./lockout/LockoutTab";import { superRefineLockout } from "./lockout/super-refine";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -157,6 +166,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityLdapAuthForm = ({@@ -164,7 +174,8 @@ export const IdentityLdapAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -172,6 +183,7 @@ export const IdentityLdapAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityLdapAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityLdapAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -312,6 +324,10 @@ export const IdentityLdapAuthForm = ({});}, [data, reset]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+useEffect(() => {if (!subscription?.ldap) {handlePopUpOpen("upgradePlan", {@@ -395,8 +411,14 @@ export const IdentityLdapAuthForm = ({reset();};+ const templateTooltipText =+ scope === "template" ? "This field cannot be modified when using a template" : null;+ const templateDisabledClass = scope === "template" ? "opacity-55" : "";+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {const firstErrorField = Object.keys(fields)[0];let tab = IdentityFormTab.Advanced;@@ -434,353 +456,422 @@ export const IdentityLdapAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Lockout}>Lockout</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- {canAttachTemplates && (+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Lockout}>Lockout</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ {canAttachTemplates && (+ <Controller+ control={control}+ name="scope"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="ldap-scope">Configuration Type</FieldLabel>+ <Select+ value={value}+ onValueChange={(val) => {+ onChange(val);+ setValue("templateId", data?.templateId || "");+ setValue("url", data?.url || "");+ setValue("bindDN", data?.bindDN || "");+ setValue("bindPass", data?.bindPass || "");+ setValue("searchBase", data?.searchBase || "");+ setValue("ldapCaCertificate", data?.ldapCaCertificate || "");+ }}+ >+ <SelectTrigger id="ldap-scope" className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select configuration type" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="template">Use Template</SelectItem>+ <SelectItem value="custom">Custom Configuration</SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ )}++ {scope === "template" && (+ <Controller+ control={control}+ name="templateId"+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="ldap-template">Template</FieldLabel>+ <Select+ value={value}+ onValueChange={(val) => {+ onChange(val);+ const tmp = templates?.find((t) => t.id === val);+ if (!tmp) return;+ setValue("url", tmp.templateFields.url);+ setValue("bindDN", tmp.templateFields.bindDN);+ setValue("bindPass", tmp.templateFields.bindPass);+ setValue("searchBase", tmp.templateFields.searchBase);+ setValue("ldapCaCertificate", tmp.templateFields.ldapCaCertificate);+ }}+ >+ <SelectTrigger id="ldap-template" className="w-full" isError={Boolean(error)}>+ <SelectValue placeholder="Select a template" />+ </SelectTrigger>+ <SelectContent>+ {templates?.map((template) => {+ return (+ <SelectItem value={template.id} key={template.id}>+ {template.name}+ </SelectItem>+ );+ })}+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ )}+<Controllercontrol={control}- name="scope"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Configuration Type"- isError={Boolean(error)}- errorText={error?.message}- >- <Select- value={value}- onValueChange={(val) => {- onChange(val);- setValue("templateId", data?.templateId || "");- setValue("url", data?.url || "");- setValue("bindDN", data?.bindDN || "");- setValue("bindPass", data?.bindPass || "");- setValue("searchBase", data?.searchBase || "");- setValue("ldapCaCertificate", data?.ldapCaCertificate || "");- }}- className="w-full"- position="popper"- dropdownContainerClassName="max-w-none"- >- <SelectItem value="template">Use Template</SelectItem>- <SelectItem value="custom">Custom Configuration</SelectItem>- </Select>- </FormControl>+ name="url"+ render={({ field, fieldState: { error } }) => (+ <Field className={templateDisabledClass}>+ <FieldLabel htmlFor="url" className="inline-flex items-center gap-1.5">+ LDAP URL+ {templateTooltipText && (+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>{templateTooltipText}</TooltipContent>+ </Tooltip>+ )}+ </FieldLabel>+ <Input+ {...field}+ id="url"+ placeholder="ldaps://domain-or-ip:636"+ type="text"+ disabled={scope === "template"}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="bindDN"+ render={({ field, fieldState: { error } }) => (+ <Field className={templateDisabledClass}>+ <FieldLabel htmlFor="bindDN" className="inline-flex items-center gap-1.5">+ Bind DN+ {templateTooltipText && (+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>{templateTooltipText}</TooltipContent>+ </Tooltip>+ )}+ </FieldLabel>+ <Input+ {...field}+ id="bindDN"+ placeholder="cn=infisical,ou=Users,dc=example,dc=com"+ disabled={scope === "template"}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="bindPass"+ render={({ field, fieldState: { error } }) => (+ <Field className={templateDisabledClass}>+ <FieldLabel htmlFor="bindPass" className="inline-flex items-center gap-1.5">+ Bind Pass+ {templateTooltipText && (+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>{templateTooltipText}</TooltipContent>+ </Tooltip>+ )}+ </FieldLabel>+ <Input+ {...field}+ id="bindPass"+ placeholder="********"+ type="password"+ disabled={scope === "template"}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="searchBase"+ render={({ field, fieldState: { error } }) => (+ <Field className={templateDisabledClass}>+ <FieldLabel htmlFor="searchBase" className="inline-flex items-center gap-1.5">+ Search Base / DN+ {templateTooltipText && (+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>{templateTooltipText}</TooltipContent>+ </Tooltip>+ )}+ </FieldLabel>+ <Input+ {...field}+ id="searchBase"+ placeholder="ou=machines,dc=acme,dc=com"+ disabled={scope === "template"}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- {scope === "template" && (<Controllercontrol={control}- name="templateId"- render={({ field: { value, onChange }, fieldState: { error } }) => (- <FormControl- label="Template"- isError={Boolean(error)}- errorText={error?.message}- isRequired- >- <Select- value={value}- onValueChange={(val) => {- onChange(val);- const tmp = templates?.find((t) => t.id === val);- if (!tmp) return;- setValue("url", tmp.templateFields.url);- setValue("bindDN", tmp.templateFields.bindDN);- setValue("bindPass", tmp.templateFields.bindPass);- setValue("searchBase", tmp.templateFields.searchBase);- setValue("ldapCaCertificate", tmp.templateFields.ldapCaCertificate);- }}- className="w-full"- position="popper"- dropdownContainerClassName="max-w-none"- placeholder="Select a template"- >- {templates?.map((template) => {- return (- <SelectItem value={template.id} key={template.id}>- {template.name}- </SelectItem>- );- })}- </Select>- </FormControl>+ name="searchFilter"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="searchFilter">Search Filter</FieldLabel>+ <Input+ {...field}+ id="searchFilter"+ placeholder="(uid={{username}})"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}-- <Controller- control={control}- name="url"- render={({ field, fieldState: { error } }) => (- <FormControl- label="LDAP URL"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- scope === "template"- ? "This field cannot be modified when using a template"- : undefined- }- isRequired- >- <Input- {...field}- placeholder="ldaps://domain-or-ip:636"- type="text"- isDisabled={scope === "template"}- containerClassName={scope === "template" ? "opacity-55" : ""}- />- </FormControl>- )}- />- <Controller- control={control}- name="bindDN"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Bind DN"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- scope === "template"- ? "This field cannot be modified when using a template"- : undefined- }- >- <Input- {...field}- containerClassName={scope === "template" ? "opacity-55" : ""}- placeholder="cn=infisical,ou=Users,dc=example,dc=com"- isDisabled={scope === "template"}- />- </FormControl>- )}- />- <Controller- control={control}- name="bindPass"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Bind Pass"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- scope === "template"- ? "This field cannot be modified when using a template"- : undefined- }- >- <Input- {...field}- placeholder="********"- type="password"- containerClassName={scope === "template" ? "opacity-55" : ""}- isDisabled={scope === "template"}- />- </FormControl>- )}- />- <Controller- control={control}- name="searchBase"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Search Base / DN"- isError={Boolean(error)}- errorText={error?.message}- tooltipText={- scope === "template"- ? "This field cannot be modified when using a template"- : undefined- }- >- <Input- {...field}- placeholder="ou=machines,dc=acme,dc=com"- containerClassName={scope === "template" ? "opacity-55" : ""}- isDisabled={scope === "template"}- />- </FormControl>- )}- />-- <Controller- control={control}- name="searchFilter"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Search Filter"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="(uid={{username}})" />- </FormControl>- )}- />- {allowedFieldsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`allowedFields.${index}.key`}- render={({ field, fieldState: { error } }) => {- const isFirstField = index === 0;-- return (- <FormControl- className="mb-0 grow"- label={isFirstField ? "Required Attributes" : undefined}- icon={- isFirstField ? (- <Tooltip- className="max-w-[420px]"- content={- <div className="max-h-[300px] space-y-4 overflow-y-auto text-sm">- <p>- Specify the fields that the user must contain in their LDAP entry- in order to authenticate with this identity. If nothing is- specified, all users in the configured LDAP directory will be able- to authenticate.- <p className="mt-2">+ <div className="flex flex-col gap-3">+ {allowedFieldsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`allowedFields.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`allowedField-key-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Required Attributes+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="max-w-[420px]">+ <div className="max-h-[300px] space-y-4 overflow-y-auto text-sm">+ <p>+ Specify the fields that the user must contain in their LDAP+ entry in order to authenticate with this identity. If nothing is+ specified, all users in the configured LDAP directory will be+ able to authenticate.+ </p>+ <p>You can specify multiple required attributes by separating themwith a comma.</p>- </p>- <div className="space-y-2">- <p>Example:</p>- <p className="text-xs text-gray-400">- 'uid' → 'user1,user2,user3'- <br />- 'mail' → '[email protected]'+ <div className="space-y-2">+ <p>Example:</p>+ <p className="text-xs text-muted">+ 'uid' → 'user1,user2,user3'+ <br />+ 'mail' → '[email protected]'+ </p>+ </div>+ <p>+ The above example would allow users with the UID user1, user2,+ or user3 to authenticate but only if their emails also match</p></div>-- <p>- The above example would allow users with the UID user1, user2, or- user3 to authenticate but only if their emails also match- </p>- </div>- }- >- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- ) : undefined- }- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="uid"- />- </FormControl>- );- }}- />- <Controller- control={control}- name={`allowedFields.${index}.value`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="userid1,userid2,userid3"- />- </FormControl>- );- }}- />- <IconButton- onClick={() => removeAllowedField(index)}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3"+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`allowedField-key-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="uid"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name={`allowedFields.${index}.value`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`allowedField-value-${index}`} className="invisible">+ Value+ </FieldLabel>+ )}+ <Input+ id={`allowedField-value-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="userid1,userid2,userid3"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove required attribute"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => removeAllowedField(index)}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"+ onClick={() =>+ appendAllowedField({+ key: "",+ value: ""+ })+ }>- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add Required Attribute+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() =>- appendAllowedField({- key: "",- value: ""- })- }- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add Required Attribute- </Button>- </div>-- <Controller- control={control}- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- tooltipText="The lifetime for an acccess token in seconds. This value will be referenced at renewal time."- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>++ <Controller+ control={control}+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL" className="inline-flex items-center gap-1.5">+ Access Token TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The lifetime for an acccess token in seconds. This value will be referenced+ at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenMaxTTL"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum lifetime for an access token in seconds. This value will be+ referenced at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent><LockoutTabcontrol={control}lockoutEnabled={lockoutEnabledWatch}@@ -790,128 +881,128 @@ export const IdentityLdapAuthForm = ({lockoutCounterResetValue={lockoutCounterResetValueWatch}lockoutCounterResetUnit={lockoutCounterResetUnitWatch}/>- <TabPanel value={IdentityFormTab.Advanced}>- <Controller- control={control}- name="ldapCaCertificate"- render={({ field, fieldState: { error } }) => (- <FormControl- label="CA Certificate"- isOptional- errorText={error?.message}- isError={Boolean(error)}- tooltipText={- scope === "template"- ? "This field cannot be modified when using a template"- : "An optional PEM-encoded CA cert for the LDAP server. This is used by the TLS client for secure communication with the LDAP server."- }- >- <TextArea- {...field}- placeholder="-----BEGIN CERTIFICATE----- ..."- className={scope === "template" ? "opacity-55" : ""}- isDisabled={scope === "template"}- />- </FormControl>- )}- />+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <Controller+ control={control}+ name="ldapCaCertificate"+ render={({ field, fieldState: { error } }) => (+ <Field className={templateDisabledClass}>+ <FieldLabel+ htmlFor="ldapCaCertificate"+ className="inline-flex items-center gap-1.5"+ >+ CA Certificate (optional)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ {templateTooltipText ||+ "An optional PEM-encoded CA cert for the LDAP server. This is used by the TLS client for secure communication with the LDAP server."}+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <TextArea+ {...field}+ id="ldapCaCertificate"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ disabled={scope === "template"}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address."- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`trustedIp-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Access Token Trusted IPs+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The IPs or CIDR ranges that access tokens can be used from. By+ default, each token is given the 0.0.0.0/0, allowing usage from any+ network address.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsxindex 887ab132d5..1f68ae4dc6 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm.tsx@@ -1,25 +1,32 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityOciAuth,useGetIdentityOciAuth,@@ -28,7 +35,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -68,6 +75,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityOciAuthForm = ({@@ -75,7 +83,8 @@ export const IdentityOciAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -83,6 +92,7 @@ export const IdentityOciAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityOciAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityOciAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -146,6 +156,10 @@ export const IdentityOciAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({tenancyOcid,allowedUsernames,@@ -189,8 +203,11 @@ export const IdentityOciAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -200,176 +217,201 @@ export const IdentityOciAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="tenancyOcid"- render={({ field, fieldState: { error } }) => (- <FormControl label="Tenancy OCID" isError={Boolean(error)} errorText={error?.message}>- <Input {...field} placeholder="ocid1.tenancy.oc1..example" />- </FormControl>- )}- />- <Controller- control={control}- name="allowedUsernames"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Usernames"- isOptional- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="user1, user2, ..." />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ name="tenancyOcid"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="tenancyOcid">Tenancy OCID</FieldLabel>+ <Input+ {...field}+ id="tenancyOcid"+ placeholder="ocid1.tenancy.oc1..example"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="allowedUsernames"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedUsernames">Allowed Usernames (optional)</FieldLabel>+ <Input+ {...field}+ id="allowedUsernames"+ placeholder="user1, user2, ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsxindex cb37fdcbb5..9a62a793f8 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm.tsx@@ -1,35 +1,40 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { HelpCircleIcon, InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import { BashGlobPatternTooltip } from "@app/components/permissions";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,TextArea,- Tooltip-} from "@app/components/v2";+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import { useAddIdentityOidcAuth, useUpdateIdentityOidcAuth } from "@app/hooks/api";import { useGetIdentityOidcAuth } from "@app/hooks/api/identities/queries";import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z.object({@@ -87,6 +92,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityOidcAuthForm = ({@@ -94,7 +100,8 @@ export const IdentityOidcAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -102,6 +109,7 @@ export const IdentityOidcAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityOidcAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityOidcAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -200,6 +208,10 @@ export const IdentityOidcAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({accessTokenTrustedIps,accessTokenTTL,@@ -264,8 +276,11 @@ export const IdentityOidcAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps", "caCert", "claimMetadataMapping"].includes(@@ -277,403 +292,450 @@ export const IdentityOidcAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="oidcDiscoveryUrl"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="OIDC Discovery URL"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- placeholder="https://token.actions.githubusercontent.com"- type="text"- />- </FormControl>- )}- />- <Controller- control={control}- name="boundIssuer"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Issuer"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- {...field}- type="text"- placeholder="https://token.actions.githubusercontent.com"- />- </FormControl>- )}- />- <Controller- control={control}- name="boundSubject"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Subject"- isError={Boolean(error)}- errorText={error?.message}- icon={- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- }- >- <Input {...field} type="text" />- </FormControl>- )}- />- <Controller- control={control}- name="boundAudiences"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Audiences"- isError={Boolean(error)}- errorText={error?.message}- icon={- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ name="oidcDiscoveryUrl"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="oidcDiscoveryUrl">OIDC Discovery URL</FieldLabel>+ <Input+ {...field}+ id="oidcDiscoveryUrl"+ placeholder="https://token.actions.githubusercontent.com"+ type="text"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="boundIssuer"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundIssuer">Issuer</FieldLabel>+ <Input+ {...field}+ id="boundIssuer"+ type="text"+ placeholder="https://token.actions.githubusercontent.com"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="boundSubject"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundSubject" className="inline-flex items-center gap-1.5">+ Subject+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} id="boundSubject" type="text" isError={Boolean(error)} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="boundAudiences"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="boundAudiences" className="inline-flex items-center gap-1.5">+ Audiences+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="boundAudiences"+ type="text"+ placeholder="service1, service2"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <div className="flex flex-col gap-3">+ {boundClaimsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`boundClaims.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`boundClaim-key-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Claims+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ <BashGlobPatternTooltip />+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`boundClaim-key-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="property"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name={`boundClaims.${index}.value`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`boundClaim-value-${index}`} className="invisible">+ Value+ </FieldLabel>+ )}+ <Input+ id={`boundClaim-value-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="value1, value2"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove claim"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => removeBoundClaimField(index)}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"+ onClick={() =>+ appendBoundClaimField({+ key: "",+ value: ""+ })}>- <Input {...field} type="text" placeholder="service1, service2" />- </FormControl>- )}- />- {boundClaimsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`boundClaims.${index}.key`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Claims" : undefined}- icon={- index === 0 ? (- <Tooltip content={<BashGlobPatternTooltip />}>- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- ) : undefined- }- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="property"- />- </FormControl>- );- }}- />- <Controller- control={control}- name={`boundClaims.${index}.value`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="value1, value2"- />- </FormControl>- );- }}- />-- <IconButton- onClick={() => removeBoundClaimField(index)}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3"- >- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add Claims+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() =>- appendBoundClaimField({- key: "",- value: ""- })- }- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add Claims- </Button>- </div>- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- <Controller- control={control}- name="caCert"- render={({ field, fieldState: { error } }) => (- <FormControl- label="CA Certificate"- errorText={error?.message}- isError={Boolean(error)}- >- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />- </FormControl>- )}- />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <Controller+ control={control}+ name="caCert"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="caCert">CA Certificate</FieldLabel>+ <TextArea+ {...field}+ id="caCert"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />- {claimMetadataMappingFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`claimMetadataMapping.${index}.key`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Token Claim Mapping" : undefined}- icon={- index === 0 ? (- <Tooltip- className="text-center"- content={- <div className="w-[180px]">- <p>Map OIDC token claims to metadata fields</p>- <p className="mt-2 text-sm">Example:</p>- <p className="mt-1 text-sm">- 'role' → 'token.groups'- </p>- <p className="mt-1 text-xs text-gray-400">- Becomes: identity.metadata.oidc.claims.role- </p>- </div>- }+ <div className="flex flex-col gap-3">+ {claimMetadataMappingFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`claimMetadataMapping.${index}.key`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`claimMetadata-key-${index}`}+ className="inline-flex items-center gap-1.5">- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />- </Tooltip>- ) : undefined- }- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="Field name"- />- </FormControl>- );- }}- />- <Controller- control={control}- name={`claimMetadataMapping.${index}.value`}- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => field.onChange(e)}- placeholder="Token claim"- />- </FormControl>- );- }}- />- <IconButton- onClick={() => removeClaimMetadataMappingField(index)}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3"+ Token Claim Mapping+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircleIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent className="text-center">+ <div className="w-[180px]">+ <p>Map OIDC token claims to metadata fields</p>+ <p className="mt-2 text-sm">Example:</p>+ <p className="mt-1 text-sm">+ 'role' → 'token.groups'+ </p>+ <p className="mt-1 text-xs text-muted">+ Becomes: identity.metadata.oidc.claims.role+ </p>+ </div>+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`claimMetadata-key-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="Field name"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name={`claimMetadataMapping.${index}.value`}+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`claimMetadata-value-${index}`}+ className="invisible"+ >+ Value+ </FieldLabel>+ )}+ <Input+ id={`claimMetadata-value-${index}`}+ value={field.value}+ onChange={(e) => field.onChange(e)}+ placeholder="Token claim"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove claim mapping"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => removeClaimMetadataMappingField(index)}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"+ onClick={() =>+ appendClaimMetadataMappingField({+ key: "",+ value: ""+ })+ }>- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add Token Mapping+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() =>- appendClaimMetadataMappingField({- key: "",- value: ""- })- }- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add Token Mapping- </Button>- </div>-- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>-- <div className="mt-8 flex justify-between">- <div className="flex items-center">- <Button- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- variant="outline_bg"- className="mr-4"- isDisabled={isSubmitting}- >- Cancel- </Button>- <Button type="submit" isLoading={isSubmitting}>- {isUpdate ? "Update" : "Add"} Auth Method- </Button>- </div>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySpiffeAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySpiffeAuthForm.tsxindex 46b3d20218..efb012683f 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySpiffeAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySpiffeAuthForm.tsx@@ -1,35 +1,45 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,Select,+ SelectContent,SelectItem,- Tab,- TabList,- TabPanel,+ SelectTrigger,+ SelectValue,Tabs,- TextArea-} from "@app/components/v2";+ TabsContent,+ TabsList,+ TabsTrigger,+ TextArea,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import { useAddIdentitySpiffeAuth, useUpdateIdentitySpiffeAuth } from "@app/hooks/api";import { SpiffeTrustBundleProfile } from "@app/hooks/api/identities/enums";import { useGetIdentitySpiffeAuth } from "@app/hooks/api/identities/queries";import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const trustBundleDistributionSchema = z.discriminatedUnion("profile", [z.object({@@ -77,6 +87,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentitySpiffeAuthForm = ({@@ -84,7 +95,8 @@ export const IdentitySpiffeAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -92,6 +104,7 @@ export const IdentitySpiffeAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentitySpiffeAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentitySpiffeAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -181,6 +194,10 @@ export const IdentitySpiffeAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({accessTokenTrustedIps,accessTokenTTL,@@ -252,8 +269,11 @@ export const IdentitySpiffeAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -263,288 +283,322 @@ export const IdentitySpiffeAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="trustBundleDistribution.profile"- render={({ field: { onChange, ...field }, fieldState: { error } }) => (- <FormControl- label="Trust Bundle Profile"- isError={Boolean(error)}- errorText={error?.message}- >- <Select- defaultValue={field.value}- {...field}- onValueChange={(e) => {- onChange(e);- }}- className="w-full"- >- <SelectItem value={SpiffeTrustBundleProfile.STATIC} key="static">- Static- </SelectItem>- <SelectItem- value={SpiffeTrustBundleProfile.HTTPS_WEB_BUNDLE}- key="https_web_bundle"- >- HTTPS Web Bundle- </SelectItem>- </Select>- </FormControl>- )}- />- <Controller- control={control}- name="trustDomain"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Trust Domain"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} type="text" placeholder="example.org" />- </FormControl>- )}- />- <Controller- control={control}- name="allowedSpiffeIds"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Allowed SPIFFE IDs"- isError={Boolean(error)}- errorText={error?.message}- >- <TextArea- {...field}- placeholder="Comma-separated list of SPIFFE IDs allowed to authenticate. Glob patterns supported: * matches a single path segment, ** matches across multiple segments (e.g. spiffe://example.org/ns/*/sa/admin, spiffe://example.org/workloads/**)"- />- </FormControl>- )}- />- <Controller- control={control}- name="allowedAudiences"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Allowed Audiences"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} type="text" placeholder="Comma-separated (e.g. aud1, aud2)" />- </FormControl>- )}- />- {selectedProfile === SpiffeTrustBundleProfile.STATIC && (+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup><Controllercontrol={control}- name="trustBundleDistribution.bundle"+ name="trustBundleDistribution.profile"+ render={({ field: { onChange, value }, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="trustBundleProfile">Trust Bundle Profile</FieldLabel>+ <Select value={value} onValueChange={onChange}>+ <SelectTrigger+ id="trustBundleProfile"+ className="w-full"+ isError={Boolean(error)}+ >+ <SelectValue placeholder="Select trust bundle profile" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value={SpiffeTrustBundleProfile.STATIC}>Static</SelectItem>+ <SelectItem value={SpiffeTrustBundleProfile.HTTPS_WEB_BUNDLE}>+ HTTPS Web Bundle+ </SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="trustDomain"render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="CA Bundle JWKS"- isError={Boolean(error)}- errorText={error?.message}- >- <TextArea {...field} placeholder="Paste SPIRE JWKS JSON" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="trustDomain">Trust Domain</FieldLabel>+ <Input+ {...field}+ id="trustDomain"+ type="text"+ placeholder="example.org"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- )}- {selectedProfile === SpiffeTrustBundleProfile.HTTPS_WEB_BUNDLE && (- <>- <Controller- control={control}- name="trustBundleDistribution.endpointUrl"- render={({ field, fieldState: { error } }) => (- <FormControl- isRequired- label="Bundle Endpoint URL"+ <Controller+ control={control}+ name="allowedSpiffeIds"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedSpiffeIds">Allowed SPIFFE IDs</FieldLabel>+ <TextArea+ {...field}+ id="allowedSpiffeIds"+ placeholder="Comma-separated list of SPIFFE IDs allowed to authenticate. Glob patterns supported: * matches a single path segment, ** matches across multiple segments (e.g. spiffe://example.org/ns/*/sa/admin, spiffe://example.org/workloads/**)"isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} type="text" placeholder="https://spire-server:8443" />- </FormControl>- )}- />- <Controller- control={control}- name="trustBundleDistribution.caCert"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Root CA Certificate (optional)"+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="allowedAudiences"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="allowedAudiences">Allowed Audiences</FieldLabel>+ <Input+ {...field}+ id="allowedAudiences"+ type="text"+ placeholder="Comma-separated (e.g. aud1, aud2)"isError={Boolean(error)}- errorText={error?.message}- >- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />- </FormControl>- )}- />+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ {selectedProfile === SpiffeTrustBundleProfile.STATIC && (<Controllercontrol={control}- name="trustBundleDistribution.refreshHintSeconds"+ name="trustBundleDistribution.bundle"render={({ field, fieldState: { error } }) => (- <FormControl- label="Bundle Refresh Hint (seconds)"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="3600" type="number" min="0" step="1" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="trustBundleBundle">CA Bundle JWKS</FieldLabel>+ <TextArea+ {...field}+ id="trustBundleBundle"+ placeholder="Paste SPIRE JWKS JSON"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- </>- )}- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>)}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >+ {selectedProfile === SpiffeTrustBundleProfile.HTTPS_WEB_BUNDLE && (+ <>+ <Controller+ control={control}+ name="trustBundleDistribution.endpointUrl"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="trustBundleEndpointUrl">Bundle Endpoint URL</FieldLabel><Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"+ {...field}+ id="trustBundleEndpointUrl"+ type="text"+ placeholder="https://spire-server:8443"+ isError={Boolean(error)}/>- </FormControl>- );- }}- />- <IconButton+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="trustBundleDistribution.caCert"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="trustBundleCaCert">+ Root CA Certificate (optional)+ </FieldLabel>+ <TextArea+ {...field}+ id="trustBundleCaCert"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="trustBundleDistribution.refreshHintSeconds"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="trustBundleRefreshHint">+ Bundle Refresh Hint (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="trustBundleRefreshHint"+ placeholder="3600"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </>+ )}+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Create"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsxindex ac37240fda..497dc31db0 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTable.tsx@@ -1,7 +1,15 @@import { useState } from "react";import { useNavigate } from "@tanstack/react-router";import { formatDistanceToNow } from "date-fns";-import { ChevronDownIcon, EditIcon, MoreHorizontalIcon, SearchIcon, TrashIcon } from "lucide-react";+import {+ ChevronDownIcon,+ EditIcon,+ LockIcon,+ MoreHorizontalIcon,+ PlusIcon,+ SearchIcon,+ TrashIcon+} from "lucide-react";import { twMerge } from "tailwind-merge";import { LastLoginSection } from "@app/components/organization/LastLoginSection";@@ -11,6 +19,9 @@ import {DropdownMenu,DropdownMenuContent,DropdownMenuItem,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,Empty,EmptyDescription,@@ -48,6 +59,7 @@ import {} from "@app/helpers/userTablePreferences";import { usePagination, useResetPageHelper } from "@app/hooks";import {+ IdentityAuthMethod,identityAuthToNameMap,useCountOrgIdentityMemberships,useSearchOrgIdentityMemberships@@ -55,7 +67,9 @@ import {import { OrderByDirection } from "@app/hooks/api/generic/types";import { IdentityMembershipSearchResult, SearchIdentitiesScope } from "@app/hooks/api/identities";import { OrgIdentityOrderBy } from "@app/hooks/api/organization/types";-import { UsePopUpState } from "@app/hooks/usePopUp";+import { usePopUp, UsePopUpState } from "@app/hooks/usePopUp";+import { IdentityAuthMethodModal } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal";+import { IdentityAuthMethodSheet } from "@app/views/IdentityAuthMethods";type Props = {handlePopUpOpen: (@@ -187,18 +201,34 @@ const LastUsedCell = ({ lastLoginAuthMethod, lastLoginTime }: LastUsedCellProps)type IdentityActionsMenuProps = {isProjectScoped: boolean;isSubOrgIdentity: boolean;+ authMethods: IdentityAuthMethod[];+ activeLockoutAuthMethods?: IdentityAuthMethod[];onEdit: () => void;onDelete: () => void;+ onManageAuth: (authMethod: IdentityAuthMethod) => void;+ onAddAuthMethod: () => void;};-const getEditLabel = ({ isProjectScoped, isSubOrgIdentity }: IdentityActionsMenuProps) => {+const getEditLabel = ({+ isProjectScoped,+ isSubOrgIdentity+}: Pick<IdentityActionsMenuProps, "isProjectScoped" | "isSubOrgIdentity">) => {if (isProjectScoped) return "Open in Project";if (isSubOrgIdentity) return "Edit Machine Identity";return "Edit Machine Identity Membership";};const IdentityActionsMenu = (props: IdentityActionsMenuProps) => {- const { isProjectScoped, isSubOrgIdentity, onEdit, onDelete } = props;+ const {+ isProjectScoped,+ isSubOrgIdentity,+ authMethods,+ activeLockoutAuthMethods,+ onEdit,+ onDelete,+ onManageAuth,+ onAddAuthMethod+ } = props;const deleteLabel = isSubOrgIdentity ? "Delete Machine Identity" : "Remove From Sub-Organization";return (@@ -238,6 +268,46 @@ const IdentityActionsMenu = (props: IdentityActionsMenuProps) => {)}</OrgPermissionCan>)}+ {isSubOrgIdentity && !isProjectScoped && (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger chevronOnLeft>Manage Auth Methods</DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ {authMethods.map((method) => (+ <DropdownMenuItem+ key={method}+ onClick={(e) => {+ e.stopPropagation();+ onManageAuth(method);+ }}+ >+ {identityAuthToNameMap[method]}+ {activeLockoutAuthMethods?.includes(method) && (+ <Badge isSquare variant="danger" className="ml-auto">+ <LockIcon className="size-3!" />+ </Badge>+ )}+ </DropdownMenuItem>+ ))}+ <OrgPermissionCan+ I={OrgPermissionIdentityActions.Edit}+ a={OrgPermissionSubjects.Identity}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ onClick={(e) => {+ e.stopPropagation();+ onAddAuthMethod();+ }}+ >+ <PlusIcon />+ Add Auth Method+ </DropdownMenuItem>+ )}+ </OrgPermissionCan>+ </DropdownMenuSubContent>+ </DropdownMenuSub>+ )}{!isProjectScoped && (<OrgPermissionCanI={OrgPermissionIdentityActions.Delete}@@ -283,19 +353,32 @@ const SkeletonRow = () => (</TableRow>);+type ManageAuthPayload = {+ identityId: string;+ authMethod: IdentityAuthMethod;+};++type AddAuthMethodPayload = {+ identityId: string;+ name: string;+ allAuthMethods: IdentityAuthMethod[];+};+type IdentityRowProps = {membership: IdentityMembershipSearchResult;onDelete: (data: { identityId: string; name: string }) => void;+ onManageAuth: (data: ManageAuthPayload) => void;+ onAddAuthMethod: (data: AddAuthMethodPayload) => void;};-const IdentityRow = ({ membership, onDelete }: IdentityRowProps) => {+const IdentityRow = ({ membership, onDelete, onManageAuth, onAddAuthMethod }: IdentityRowProps) => {const navigate = useNavigate();const { currentOrg, isSubOrganization } = useOrganization();const {scope,project,- identity: { id, name, orgId },+ identity: { id, name, orgId, authMethods, activeLockoutAuthMethods },roles: membershipRoles,lastLoginAuthMethod,lastLoginTime@@ -340,12 +423,34 @@ const IdentityRow = ({ membership, onDelete }: IdentityRowProps) => {<LastUsedCell lastLoginAuthMethod={lastLoginAuthMethod} lastLoginTime={lastLoginTime} /></TableCell><TableCell>- <IdentityActionsMenu- isProjectScoped={isProjectScoped}- isSubOrgIdentity={isSubOrgIdentity}- onEdit={navigateToIdentity}- onDelete={() => onDelete({ identityId: id, name })}- />+ <div className="flex items-center justify-end gap-2">+ {(activeLockoutAuthMethods?.length ?? 0) > 0 && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge isSquare variant="danger">+ <LockIcon />+ </Badge>+ </TooltipTrigger>+ <TooltipContent>+ {`Locked out: ${activeLockoutAuthMethods+ .map((m) => identityAuthToNameMap[m])+ .join(", ")}`}+ </TooltipContent>+ </Tooltip>+ )}+ <IdentityActionsMenu+ isProjectScoped={isProjectScoped}+ isSubOrgIdentity={isSubOrgIdentity}+ authMethods={authMethods ?? []}+ activeLockoutAuthMethods={activeLockoutAuthMethods}+ onEdit={navigateToIdentity}+ onDelete={() => onDelete({ identityId: id, name })}+ onManageAuth={(authMethod) => onManageAuth({ identityId: id, authMethod })}+ onAddAuthMethod={() =>+ onAddAuthMethod({ identityId: id, name, allAuthMethods: authMethods ?? [] })+ }+ />+ </div></TableCell></TableRow>);@@ -396,7 +501,18 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {}: {};- const { data, isPending } = useSearchOrgIdentityMemberships({+ const {+ popUp: authMethodPopUp,+ handlePopUpOpen: handleAuthMethodPopUpOpen,+ handlePopUpToggle: handleAuthMethodPopUpToggle+ } = usePopUp(["identityAuthMethod", "upgradePlan"] as const);++ const [viewAuthMethodState, setViewAuthMethodState] = useState<{+ identityId: string;+ authMethod: IdentityAuthMethod;+ } | null>(null);++ const { data, isPending, refetch } = useSearchOrgIdentityMemberships({orgId: organizationId,offset,limit,@@ -544,6 +660,10 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {key={`identity-${membership.id}`}membership={membership}onDelete={(payload) => handlePopUpOpen("deleteIdentity", payload)}+ onManageAuth={(payload) => setViewAuthMethodState(payload)}+ onAddAuthMethod={(payload) =>+ handleAuthMethodPopUpOpen("identityAuthMethod", payload)+ }/>))}</TableBody>@@ -559,6 +679,35 @@ export const IdentityTable = ({ handlePopUpOpen }: Props) => {)}</>)}+ <IdentityAuthMethodModal+ popUp={authMethodPopUp}+ handlePopUpOpen={handleAuthMethodPopUpOpen}+ handlePopUpToggle={handleAuthMethodPopUpToggle}+ />+ {viewAuthMethodState &&+ (() => {+ const viewedIdentity = data?.identities?.find(+ ({ identity }) => identity.id === viewAuthMethodState.identityId+ )?.identity;+ if (!viewedIdentity) return null;+ return (+ <IdentityAuthMethodSheet+ open+ onOpenChange={(open) => {+ if (!open) setViewAuthMethodState(null);+ }}+ identityId={viewAuthMethodState.identityId}+ identityName={viewedIdentity.name}+ authMethod={viewAuthMethodState.authMethod}+ allAuthMethods={viewedIdentity.authMethods}+ isLockedOut={+ viewedIdentity.activeLockoutAuthMethods?.includes(viewAuthMethodState.authMethod) ??+ false+ }+ onMutated={refetch}+ />+ );+ })()}</>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsxindex 2d78512979..31f7cc94f0 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx@@ -1,26 +1,33 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,Tabs,- TextArea-} from "@app/components/v2";+ TabsContent,+ TabsList,+ TabsTrigger,+ TextArea,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityTlsCertAuth,useGetIdentityTlsCertAuth,@@ -29,7 +36,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z.object({@@ -61,6 +68,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityTlsCertAuthForm = ({@@ -68,7 +76,8 @@ export const IdentityTlsCertAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -76,6 +85,7 @@ export const IdentityTlsCertAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityTlsCertAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityTlsCertAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -137,6 +147,10 @@ export const IdentityTlsCertAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({caCertificate,allowedCommonNames,@@ -180,190 +194,264 @@ export const IdentityTlsCertAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (- <form onSubmit={handleSubmit(onFormSubmit)}>+ <form id={IDENTITY_AUTH_FORM_ID} onSubmit={handleSubmit(onFormSubmit)}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- name="caCertificate"- render={({ field, fieldState: { error } }) => (- <FormControl- label="CA Certificate"- errorText={error?.message}- isError={Boolean(error)}- tooltipText="A PEM-encoded CA certificate. This will be used to validate client certificate."- >- <TextArea {...field} placeholder="-----BEGIN CERTIFICATE----- ..." />- </FormControl>- )}- />-- <Controller- control={control}- defaultValue=""- name="allowedCommonNames"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Allowed Common Names"- isError={Boolean(error)}- isOptional- errorText={error?.message}- tooltipText="Comma separated common names allowed to authenticate against the identity. Leave empty to allow any certificate."- >- <Input {...field} placeholder="" type="text" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- tooltipText="The lifetime for an access token in seconds. This value will be referenced at renewal time."- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum lifetime for an access token in seconds. This value will be referenced at renewal time."- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The IPs or CIDR ranges that access tokens can be used from. By default, each token is given the 0.0.0.0/0, allowing usage from any network address."- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ name="caCertificate"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="caCertificate" className="inline-flex items-center gap-1.5">+ CA Certificate+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ A PEM-encoded CA certificate. This will be used to validate client+ certificate.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <TextArea+ {...field}+ id="caCertificate"+ placeholder="-----BEGIN CERTIFICATE----- ..."+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <Controller+ control={control}+ defaultValue=""+ name="allowedCommonNames"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="allowedCommonNames"+ className="inline-flex items-center gap-1.5"+ >+ Allowed Common Names (optional)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ Comma separated common names allowed to authenticate against the identity.+ Leave empty to allow any certificate.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input {...field} id="allowedCommonNames" type="text" isError={Boolean(error)} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL" className="inline-flex items-center gap-1.5">+ Access Token TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The lifetime for an access token in seconds. This value will be referenced+ at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenMaxTTL"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max TTL (seconds)+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum lifetime for an access token in seconds. This value will be+ referenced at renewal time.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel+ htmlFor={`trustedIp-${index}`}+ className="inline-flex items-center gap-1.5"+ >+ Access Token Trusted IPs+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The IPs or CIDR ranges that access tokens can be used from. By+ default, each token is given the 0.0.0.0/0, allowing usage from any+ network address.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsxindex f1f765f58e..9d25165940 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm.tsx@@ -1,25 +1,32 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityTokenAuth,useGetIdentityTokenAuth,@@ -28,7 +35,7 @@ import {import { IdentityTrustedIp } from "@app/hooks/api/identities/types";import { UsePopUpState } from "@app/hooks/usePopUp";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -60,6 +67,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityTokenAuthForm = ({@@ -67,7 +75,8 @@ export const IdentityTokenAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";@@ -75,6 +84,7 @@ export const IdentityTokenAuthForm = ({const { projectId } = useParams({strict: false});+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityTokenAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityTokenAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -132,6 +142,10 @@ export const IdentityTokenAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({accessTokenTTL,accessTokenMaxTTL,@@ -170,8 +184,11 @@ export const IdentityTokenAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {setTabValue(["accessTokenTrustedIps"].includes(Object.keys(fields)[0])@@ -181,153 +198,169 @@ export const IdentityTokenAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>- <TabPanel value={IdentityFormTab.Advanced}>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5"+ >+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent>+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`trustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`trustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>-- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsxindex 298cdc9460..2e4468e413 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm.tsx@@ -1,26 +1,33 @@import { useEffect, useMemo, useState } from "react";import { Controller, useFieldArray, useForm } from "react-hook-form";-import { faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";import { useParams } from "@tanstack/react-router";+import { InfoIcon, PlusIcon, XIcon } from "lucide-react";import ms from "ms";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Field,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,IconButton,Input,- Tab,- TabList,- TabPanel,- Tabs-} from "@app/components/v2";+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useOrganization, useSubscription } from "@app/context";import { getObjectFromSeconds, SECONDS_PER_DAY } from "@app/helpers/datetime";import { accessTokenTtlSchema } from "@app/helpers/identityAuthSchemas";+import { useScopeVariant } from "@app/hooks";import {useAddIdentityUniversalAuth,useGetIdentityUniversalAuth,@@ -31,7 +38,7 @@ import { UsePopUpState } from "@app/hooks/usePopUp";import { LockoutTab } from "./lockout/LockoutTab";import { superRefineLockout } from "./lockout/super-refine";-import { IdentityFormTab } from "./types";+import { IDENTITY_AUTH_FORM_ID, IdentityFormTab } from "./types";const buildSchema = (maxAccessTokenTTL: number) =>z@@ -85,6 +92,7 @@ type Props = {identityId?: string;isUpdate?: boolean;maxAccessTokenTTL: number;+ onSubmittingChange?: (isSubmitting: boolean) => void;};export const IdentityUniversalAuthForm = ({@@ -92,7 +100,8 @@ export const IdentityUniversalAuthForm = ({handlePopUpToggle,identityId,isUpdate,- maxAccessTokenTTL+ maxAccessTokenTTL,+ onSubmittingChange}: Props) => {const { projectId } = useParams({strict: false@@ -100,6 +109,7 @@ export const IdentityUniversalAuthForm = ({const { currentOrg } = useOrganization();const orgId = currentOrg?.id || "";const { subscription } = useSubscription();+ const scopeVariant = useScopeVariant();const { mutateAsync: addMutateAsync } = useAddIdentityUniversalAuth();const { mutateAsync: updateMutateAsync } = useUpdateIdentityUniversalAuth();const [tabValue, setTabValue] = useState<IdentityFormTab>(IdentityFormTab.Configuration);@@ -205,6 +215,10 @@ export const IdentityUniversalAuthForm = ({}}, [data]);+ useEffect(() => {+ onSubmittingChange?.(isSubmitting);+ }, [isSubmitting, onSubmittingChange]);+const onFormSubmit = async ({accessTokenTTL,accessTokenMaxTTL,@@ -269,8 +283,11 @@ export const IdentityUniversalAuthForm = ({reset();};+ const maxDaysHelper = `Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`;+return (<form+ id={IDENTITY_AUTH_FORM_ID}onSubmit={handleSubmit(onFormSubmit, (fields) => {const firstErrorField = Object.keys(fields)[0];let tab = IdentityFormTab.Configuration;@@ -294,81 +311,125 @@ export const IdentityUniversalAuthForm = ({})}><Tabs value={tabValue} onValueChange={(value) => setTabValue(value as IdentityFormTab)}>- <TabList>- <Tab value={IdentityFormTab.Configuration}>Configuration</Tab>- <Tab value={IdentityFormTab.Lockout}>Lockout</Tab>- <Tab value={IdentityFormTab.Advanced}>Advanced</Tab>- </TabList>- <TabPanel value={IdentityFormTab.Configuration}>- {accessTokenPeriodValue > 0 ? (- <div className="mb-4 text-xs text-bunker-400">- When Access Token Period is set, TTL and Max TTL are ignored.- </div>- ) : (- <>- <Controller- control={control}- defaultValue="2592000"- name="accessTokenTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token TTL (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}+ <TabsList variant={scopeVariant}>+ <TabsTrigger value={IdentityFormTab.Configuration}>Configuration</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Lockout}>Lockout</TabsTrigger>+ <TabsTrigger value={IdentityFormTab.Advanced}>Advanced</TabsTrigger>+ </TabsList>+ <TabsContent value={IdentityFormTab.Configuration}>+ <FieldGroup>+ {accessTokenPeriodValue > 0 ? (+ <div className="text-xs text-muted">+ When Access Token Period is set, TTL and Max TTL are ignored.+ </div>+ ) : (+ <>+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenTTL">Access Token TTL (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="2592000"+ name="accessTokenMaxTTL"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenMaxTTL">+ Access Token Max TTL (seconds)+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenMaxTTL"+ placeholder="2592000"+ type="number"+ min="1"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>{maxDaysHelper}</FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </>+ )}+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenNumUsesLimit"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel+ htmlFor="accessTokenNumUsesLimit"+ className="inline-flex items-center gap-1.5">- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="2592000"- name="accessTokenMaxTTL"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max TTL (seconds)"+ Access Token Max Number of Uses+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The maximum number of times that an access token can be used; leave blank+ for unlimited uses.+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="accessTokenNumUsesLimit"+ placeholder="Unlimited uses"+ type="number"+ min="0"+ step="1"isError={Boolean(error)}- errorText={error?.message}- helperText={`Max: ${Math.floor(maxAccessTokenTTL / SECONDS_PER_DAY)} days`}- >- <Input {...field} placeholder="2592000" type="number" min="1" step="1" />- </FormControl>- )}- />- </>- )}- <Controller- control={control}- defaultValue="0"- name="accessTokenNumUsesLimit"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The maximum number of times that an access token can be used; Leave blank for unlimited uses."- >- <Input {...field} placeholder="Unlimited uses" type="number" min="0" step="1" />- </FormControl>- )}- />- <Controller- control={control}- defaultValue="0"- name="accessTokenPeriod"- render={({ field, fieldState: { error } }) => (- <FormControl- label="Access Token Period (seconds)"- isError={Boolean(error)}- errorText={error?.message}- helperText="For periodic tokens: set a period (in seconds) to allow indefinite renewal. Set to 0 to disable periodic tokens and use TTL-based expiration."- >- <Input {...field} placeholder="0" type="number" min="0" step="1" />- </FormControl>- )}- />- </TabPanel>+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ defaultValue="0"+ name="accessTokenPeriod"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="accessTokenPeriod">Access Token Period (seconds)</FieldLabel>+ <Input+ {...field}+ id="accessTokenPeriod"+ placeholder="0"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldDescription>+ For periodic tokens: set a period (in seconds) to allow indefinite renewal. Set+ to 0 to disable periodic tokens and use TTL-based expiration.+ </FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </FieldGroup>+ </TabsContent><LockoutTabcontrol={control}lockoutEnabled={lockoutEnabledWatch}@@ -378,175 +439,155 @@ export const IdentityUniversalAuthForm = ({lockoutCounterResetValue={lockoutCounterResetValueWatch}lockoutCounterResetUnit={lockoutCounterResetUnitWatch}/>- <TabPanel value={IdentityFormTab.Advanced}>- {clientSecretTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`clientSecretTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Client Secret Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <TabsContent value={IdentityFormTab.Advanced}>+ <FieldGroup>+ <div className="flex flex-col gap-3">+ {clientSecretTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`clientSecretTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`clientSecretTrustedIp-${index}`}>+ Client Secret Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`clientSecretTrustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeClientSecretTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeClientSecretTrustedIp(index);+ appendClientSecretTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendClientSecretTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- {accessTokenTrustedIpsFields.map(({ id }, index) => (- <div className="mb-3 flex items-end space-x-2" key={id}>- <Controller- control={control}- name={`accessTokenTrustedIps.${index}.ipAddress`}- defaultValue="0.0.0.0/0"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className="mb-0 grow"- label={index === 0 ? "Access Token Trusted IPs" : undefined}- isError={Boolean(error)}- errorText={error?.message}- >- <Input- value={field.value}- onChange={(e) => {- if (subscription?.ipAllowlisting) {- field.onChange(e);- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- placeholder="123.456.789.0"- />- </FormControl>- );- }}- />- <IconButton+ <div className="flex flex-col gap-3">+ {accessTokenTrustedIpsFields.map(({ id }, index) => (+ <div className="flex items-start gap-2" key={id}>+ <Controller+ control={control}+ name={`accessTokenTrustedIps.${index}.ipAddress`}+ defaultValue="0.0.0.0/0"+ render={({ field, fieldState: { error } }) => (+ <Field className="flex-1">+ {index === 0 && (+ <FieldLabel htmlFor={`accessTokenTrustedIp-${index}`}>+ Access Token Trusted IPs+ </FieldLabel>+ )}+ <Input+ id={`accessTokenTrustedIp-${index}`}+ value={field.value}+ onChange={(e) => {+ if (subscription?.ipAllowlisting) {+ field.onChange(e);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ placeholder="123.456.789.0"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <IconButton+ type="button"+ variant="ghost"+ size="sm"+ aria-label="Remove trusted IP"+ className={index === 0 ? "mt-[1.625rem]" : "mt-0.5"}+ onClick={() => {+ if (subscription?.ipAllowlisting) {+ removeAccessTokenTrustedIp(index);+ return;+ }+ handlePopUpOpen("upgradePlan", {+ featureName: "IP allowlisting"+ });+ }}+ >+ <XIcon />+ </IconButton>+ </div>+ ))}+ <Button+ type="button"+ variant="outline"+ size="xs"+ className="w-fit"onClick={() => {if (subscription?.ipAllowlisting) {- removeAccessTokenTrustedIp(index);+ appendAccessTokenTrustedIp({ ipAddress: "0.0.0.0/0" });return;}-handlePopUpOpen("upgradePlan", {featureName: "IP allowlisting"});}}- size="lg"- colorSchema="danger"- variant="plain"- ariaLabel="update"- className="p-3">- <FontAwesomeIcon icon={faXmark} />- </IconButton>+ <PlusIcon />+ Add IP Address+ </Button></div>- ))}- <div className="my-4 ml-1">- <Button- variant="outline_bg"- onClick={() => {- if (subscription?.ipAllowlisting) {- appendAccessTokenTrustedIp({- ipAddress: "0.0.0.0/0"- });- return;- }-- handlePopUpOpen("upgradePlan", {- featureName: "IP allowlisting"- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- size="xs"- >- Add IP Address- </Button>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent></Tabs>- <div className="flex items-center">- <Button- className="mr-4"- size="sm"- type="submit"- isLoading={isSubmitting}- isDisabled={isSubmitting}- >- {isUpdate ? "Update" : "Add"}- </Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("identityAuthMethod", false)}- >- Cancel- </Button>- </div></form>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/lockout/LockoutTab.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/lockout/LockoutTab.tsxindex d5834d8396..487362a9f3 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/lockout/LockoutTab.tsx+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/lockout/LockoutTab.tsx@@ -1,6 +1,27 @@import { Control, Controller } from "react-hook-form";+import { InfoIcon } from "lucide-react";-import { FormControl, Input, Select, SelectItem, Switch, TabPanel } from "@app/components/v2";+import {+ Field,+ FieldContent,+ FieldDescription,+ FieldError,+ FieldGroup,+ FieldLabel,+ FieldTitle,+ Input,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Switch,+ TabsContent,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { useScopeVariant } from "@app/hooks";import { IdentityFormTab } from "../types";@@ -21,185 +42,194 @@ export const LockoutTab = ({lockoutCounterResetValue: string;lockoutCounterResetUnit: "s" | "m" | "h";}) => {+ const scopeVariant = useScopeVariant();+return (- <TabPanel value={IdentityFormTab.Lockout}>- <div className="mb-3 flex flex-col">+ <TabsContent value={IdentityFormTab.Lockout}>+ <FieldGroup><Controllercontrol={control}name="lockoutEnabled"render={({ field: { value, onChange }, fieldState: { error } }) => {return (- <FormControl- helperText={`The lockout feature will prevent login attempts for ${lockoutDurationValue}${lockoutDurationUnit} after ${lockoutThreshold} consecutive login failures. If ${lockoutCounterResetValue}${lockoutCounterResetUnit} pass after the most recent failure, the lockout counter resets.`}- isError={Boolean(error)}- errorText={error?.message}- >+ <Field orientation="horizontal">+ <FieldContent>+ <FieldTitle>Lockout</FieldTitle>+ <FieldDescription>+ {`The lockout feature will prevent login attempts for ${lockoutDurationValue}${lockoutDurationUnit} after ${lockoutThreshold} consecutive login failures. If ${lockoutCounterResetValue}${lockoutCounterResetUnit} pass after the most recent failure, the lockout counter resets.`}+ </FieldDescription>+ <FieldError>{error?.message}</FieldError>+ </FieldContent><Switch- className="mr-3 ml-0 bg-mineshaft-400/80 shadow-inner data-[state=checked]:bg-green/80"- containerClassName="flex-row-reverse w-fit"id="lockout-enabled"- thumbClassName="bg-mineshaft-800"+ variant={scopeVariant}+ checked={value}onCheckedChange={onChange}- isChecked={value}- >- Lockout- </Switch>- </FormControl>+ />+ </Field>+ );+ }}+ />+ <Controller+ control={control}+ name="lockoutThreshold"+ render={({ field, fieldState: { error } }) => {+ return (+ <Field className={lockoutEnabled ? "" : "opacity-70"}>+ <FieldLabel htmlFor="lockoutThreshold" className="inline-flex items-center gap-1.5">+ Lockout Threshold+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ The amount of times login must fail before locking the identity auth method+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="lockoutThreshold"+ placeholder="Enter lockout threshold..."+ disabled={!lockoutEnabled}+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>);}}/>- <div className="flex flex-col gap-2">+ <div className="flex items-start gap-2"><Controllercontrol={control}- name="lockoutThreshold"+ name="lockoutDurationValue"render={({ field, fieldState: { error } }) => {return (- <FormControl- className={`mb-0 grow ${lockoutEnabled ? "" : "opacity-70"}`}- label="Lockout Threshold"- isError={Boolean(error)}- errorText={error?.message}- tooltipText="The amount of times login must fail before locking the identity auth method"- >+ <Field className={`flex-1 ${lockoutEnabled ? "" : "opacity-70"}`}>+ <FieldLabel+ htmlFor="lockoutDurationValue"+ className="inline-flex items-center gap-1.5 whitespace-nowrap"+ >+ Lockout Duration+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ How long an identity auth method lockout lasts+ </TooltipContent>+ </Tooltip>+ </FieldLabel><Input{...field}- placeholder="Enter lockout threshold..."- isDisabled={!lockoutEnabled}+ id="lockoutDurationValue"+ placeholder="Enter lockout duration..."+ disabled={!lockoutEnabled}+ isError={Boolean(error)}/>- </FormControl>+ <FieldError>{error?.message}</FieldError>+ </Field>);}}/>- <div className="flex items-end gap-2">- <Controller- control={control}- name="lockoutDurationValue"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className={`mb-0 grow ${lockoutEnabled ? "" : "opacity-70"}`}- label="Lockout Duration"+ <Controller+ control={control}+ name="lockoutDurationUnit"+ render={({ field, fieldState: { error } }) => (+ <Field className={lockoutEnabled ? "" : "opacity-70"}>+ <FieldLabel htmlFor="lockoutDurationUnit" className="invisible">+ Unit+ </FieldLabel>+ <Select+ disabled={!lockoutEnabled}+ value={field.value}+ onValueChange={field.onChange}+ >+ <SelectTrigger+ id="lockoutDurationUnit"+ className="min-w-32"isError={Boolean(error)}- errorText={error?.message}- tooltipText="How long an identity auth method lockout lasts">- <Input- {...field}- placeholder="Enter lockout duration..."- isDisabled={!lockoutEnabled}- />- </FormControl>- );- }}- />- <Controller- control={control}- name="lockoutDurationUnit"- render={({ field, fieldState: { error } }) => (- <FormControl- className={`mb-0 ${lockoutEnabled ? "" : "opacity-70"}`}- isError={Boolean(error)}- errorText={error?.message}- >- <Select- isDisabled={!lockoutEnabled}- value={field.value}- className="min-w-32 pr-2"- onValueChange={field.onChange}- position="popper"+ <SelectValue placeholder="Select unit" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="s">Seconds</SelectItem>+ <SelectItem value="m">Minutes</SelectItem>+ <SelectItem value="h">Hours</SelectItem>+ <SelectItem value="d">Days</SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ </div>+ <div className="flex items-start gap-2">+ <Controller+ control={control}+ name="lockoutCounterResetValue"+ render={({ field, fieldState: { error } }) => {+ return (+ <Field className={`flex-1 ${lockoutEnabled ? "" : "opacity-70"}`}>+ <FieldLabel+ htmlFor="lockoutCounterResetValue"+ className="inline-flex items-center gap-1.5 whitespace-nowrap">- <SelectItem- value="s"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Seconds</div>- </SelectItem>- <SelectItem- value="m"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Minutes</div>- </SelectItem>- <SelectItem- value="h"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Hours</div>- </SelectItem>- <SelectItem- value="d"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Days</div>- </SelectItem>- </Select>- </FormControl>- )}- />- </div>- <div className="flex items-end gap-2">- <Controller- control={control}- name="lockoutCounterResetValue"- render={({ field, fieldState: { error } }) => {- return (- <FormControl- className={`mb-0 grow ${lockoutEnabled ? "" : "opacity-70"}`}- label="Lockout Counter Reset"+ Lockout Counter Reset+ <Tooltip>+ <TooltipTrigger asChild>+ <InfoIcon className="size-3.5 text-muted" />+ </TooltipTrigger>+ <TooltipContent>+ How long to wait from the most recent failed login until resetting the+ lockout counter+ </TooltipContent>+ </Tooltip>+ </FieldLabel>+ <Input+ {...field}+ id="lockoutCounterResetValue"+ placeholder="Enter lockout counter reset..."+ disabled={!lockoutEnabled}isError={Boolean(error)}- errorText={error?.message}- tooltipText="How long to wait from the most recent failed login until resetting the lockout counter"- >- <Input- {...field}- placeholder="Enter lockout counter reset..."- isDisabled={!lockoutEnabled}- />- </FormControl>- );- }}- />- <Controller- control={control}- name="lockoutCounterResetUnit"- render={({ field, fieldState: { error } }) => (- <FormControl- className={`mb-0 ${lockoutEnabled ? "" : "opacity-70"}`}- isError={Boolean(error)}- errorText={error?.message}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ );+ }}+ />+ <Controller+ control={control}+ name="lockoutCounterResetUnit"+ render={({ field, fieldState: { error } }) => (+ <Field className={lockoutEnabled ? "" : "opacity-70"}>+ <FieldLabel htmlFor="lockoutCounterResetUnit" className="invisible">+ Unit+ </FieldLabel>+ <Select+ disabled={!lockoutEnabled}+ value={field.value}+ onValueChange={field.onChange}>- <Select- isDisabled={!lockoutEnabled}- value={field.value}- className="min-w-32 pr-2"- onValueChange={field.onChange}- position="popper"+ <SelectTrigger+ id="lockoutCounterResetUnit"+ className="min-w-32"+ isError={Boolean(error)}>- <SelectItem- value="s"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Seconds</div>- </SelectItem>- <SelectItem- value="m"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Minutes</div>- </SelectItem>- <SelectItem- value="h"- className="relative py-2 pr-8 pl-6 text-sm hover:bg-mineshaft-700"- >- <div className="ml-3 font-medium">Hours</div>- </SelectItem>- </Select>- </FormControl>- )}- />- </div>+ <SelectValue placeholder="Select unit" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="s">Seconds</SelectItem>+ <SelectItem value="m">Minutes</SelectItem>+ <SelectItem value="h">Hours</SelectItem>+ </SelectContent>+ </Select>+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ /></div>- </div>- </TabPanel>+ </FieldGroup>+ </TabsContent>);};diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/types/index.ts b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/types/index.tsindex f1c7015c42..9dac07b29d 100644--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/types/index.ts+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/types/index.ts@@ -3,3 +3,5 @@ export enum IdentityFormTab {Lockout = "lockout",Configuration = "configuration"}++export const IDENTITY_AUTH_FORM_ID = "identity-auth-form";diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsxindex 9fdeeffe72..f9a896211a 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityAuthenticationSection/IdentityAuthenticationSection.tsx@@ -18,8 +18,7 @@ import {import { OrgPermissionIdentityActions, OrgPermissionSubjects, useOrganization } from "@app/context";import { IdentityAuthMethod, useGetOrgIdentityMembershipById } from "@app/hooks/api";import { UsePopUpState } from "@app/hooks/usePopUp";--import { ViewIdentityAuth } from "../ViewIdentityAuth";+import { IdentityAuthMethodsTable } from "@app/views/IdentityAuthMethods";type Props = {identityId: string;@@ -74,11 +73,12 @@ export const IdentityAuthenticationSection = ({ identityId, handlePopUpOpen }: P</CardHeader><CardContent>{data.identity.authMethods.length > 0 ? (- <ViewIdentityAuth- activeLockoutAuthMethods={data.identity.activeLockoutAuthMethods}+ <IdentityAuthMethodsTableidentityId={identityId}+ identityName={data.identity.name}authMethods={data.identity.authMethods}- onResetAllLockouts={refetch}+ activeLockoutAuthMethods={data.identity.activeLockoutAuthMethods}+ onMutated={refetch}/>) : (<Empty className="border">diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityClientSecretModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityClientSecretModal.tsxindex b4fbd131ea..a25dfe8c9b 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityClientSecretModal.tsx+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityClientSecretModal.tsx@@ -1,21 +1,25 @@import { useState } from "react";import { Controller, useForm } from "react-hook-form";-import { faCheck, faCopy } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";+import { ClipboardCheck, Copy } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldError,+ FieldLabel,IconButton,- Input,- Modal,- ModalContent,- Tooltip-} from "@app/components/v2";-import { useTimedReset } from "@app/hooks";+ Input+} from "@app/components/v3";+import { useScopeVariant, useTimedReset } from "@app/hooks";import { useCreateIdentityUniversalAuthClientSecret } from "@app/hooks/api";import { UsePopUpState } from "@app/hooks/usePopUp";@@ -38,8 +42,9 @@ type Props = {export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) => {const { mutateAsync: createClientSecret } = useCreateIdentityUniversalAuthClientSecret();+ const scopeVariant = useScopeVariant();const [token, setToken] = useState("");- const [copyTextToken, isCopyingToken, setCopyTextToken] = useTimedReset<string>({+ const [, isCopyingToken, setCopyTextToken] = useTimedReset<string>({initialState: "Copy to clipboard"});const hasToken = Boolean(token);@@ -62,6 +67,14 @@ export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) =identityId: string;};+ const handleOpenChange = (isOpen: boolean) => {+ handlePopUpToggle("clientSecret", isOpen);+ if (!isOpen) {+ reset();+ setToken("");+ }+ };+const onFormSubmit = async ({ description, ttl, numUsesLimit }: FormData) => {const { clientSecret } = await createClientSecret({identityId: popUpData.identityId,@@ -81,32 +94,29 @@ export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) =};return (- <Modal- isOpen={popUp?.clientSecret?.isOpen}- onOpenChange={(isOpen) => {- handlePopUpToggle("clientSecret", isOpen);- reset();- setToken("");- }}- >- <ModalContent- title="Create Client Secret"- subTitle={hasToken ? "We will only show this secret once" : ""}- >+ <Dialog open={popUp?.clientSecret?.isOpen} onOpenChange={handleOpenChange}>+ <DialogContent className="max-w-xl">+ <DialogHeader>+ <DialogTitle>Create Client Secret</DialogTitle>+ {hasToken && <DialogDescription>We will only show this secret once</DialogDescription>}+ </DialogHeader>{!hasToken ? (- <form onSubmit={handleSubmit(onFormSubmit)}>+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4"><Controllercontrol={control}defaultValue=""name="description"render={({ field, fieldState: { error } }) => (- <FormControl- label="Description"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="My Client Secret" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="client-secret-description">Description</FieldLabel>+ <Input+ {...field}+ id="client-secret-description"+ placeholder="My Client Secret"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><Controller@@ -114,15 +124,19 @@ export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) =defaultValue=""name="ttl"render={({ field, fieldState: { error } }) => (- <FormControl- label="TTL (seconds - optional)"- isError={Boolean(error)}- errorText={error?.message}- >- <div className="flex">- <Input {...field} placeholder="0" type="number" min="0" step="1" />- </div>- </FormControl>+ <Field>+ <FieldLabel htmlFor="client-secret-ttl">TTL (seconds) - optional</FieldLabel>+ <Input+ {...field}+ id="client-secret-ttl"+ placeholder="0"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/><Controller@@ -130,53 +144,64 @@ export const IdentityClientSecretModal = ({ popUp, handlePopUpToggle }: Props) =defaultValue=""name="numUsesLimit"render={({ field, fieldState: { error } }) => (- <FormControl- label="Max Number of Uses"- isError={Boolean(error)}- errorText={error?.message}- >- <Input {...field} placeholder="0" type="number" min="0" step="1" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="client-secret-num-uses-limit">Max Number of Uses</FieldLabel>+ <Input+ {...field}+ id="client-secret-num-uses-limit"+ placeholder="0"+ type="number"+ min="0"+ step="1"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- <div className="flex items-center">+ <DialogFooter>+ <Button type="button" variant="ghost" onClick={() => handleOpenChange(false)}>+ Cancel+ </Button><Button- className="mr-4"- size="sm"type="submit"- isLoading={isSubmitting}+ variant={scopeVariant}+ isPending={isSubmitting}isDisabled={isSubmitting}>Create</Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("clientSecret", false)}- >- Cancel- </Button>- </div>+ </DialogFooter></form>) : (- <div className="mt-2 mr-2 mb-3 flex items-center justify-end rounded-md bg-white/[0.07] p-2 text-base text-gray-400">- <p className="mr-4 break-all">{token}</p>- <Tooltip content={copyTextToken}>+ <>+ <div className="relative flex items-center justify-between rounded-md border border-border bg-container p-2 pr-5 pl-3 text-base text-label">+ <p className="mr-4 break-all">{token}</p><IconButton- ariaLabel="copy icon"- colorSchema="secondary"- className="group relative"+ aria-label="copy icon"+ variant="ghost-muted"+ size="sm"+ className="absolute top-1 right-1"onClick={() => {navigator.clipboard.writeText(token);setCopyTextToken("Copied");}}>- <FontAwesomeIcon icon={isCopyingToken ? faCheck : faCopy} />+ {isCopyingToken ? (+ <ClipboardCheck className="size-4" />+ ) : (+ <Copy className="size-4" />+ )}</IconButton>- </Tooltip>- </div>+ </div>+ <DialogFooter>+ <Button type="button" variant="ghost" onClick={() => handleOpenChange(false)}>+ Close+ </Button>+ </DialogFooter>+ </>)}- </ModalContent>- </Modal>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsxindex d5c1aa2ac8..ac43e31bac 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/IdentityTokenModal.tsx@@ -1,21 +1,25 @@import { useEffect, useState } from "react";import { Controller, useForm } from "react-hook-form";-import { faCheck, faCopy } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { zodResolver } from "@hookform/resolvers/zod";+import { ClipboardCheck, Copy } from "lucide-react";import { z } from "zod";import { createNotification } from "@app/components/notifications";import {Button,- FormControl,+ Dialog,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldError,+ FieldLabel,IconButton,- Input,- Modal,- ModalContent,- Tooltip-} from "@app/components/v2";-import { useTimedReset } from "@app/hooks";+ Input+} from "@app/components/v3";+import { useScopeVariant, useTimedReset } from "@app/hooks";import { useCreateTokenIdentityTokenAuth, useUpdateIdentityTokenAuthToken } from "@app/hooks/api";import { UsePopUpState } from "@app/hooks/usePopUp";@@ -35,8 +39,9 @@ type Props = {export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {const { mutateAsync: createToken } = useCreateTokenIdentityTokenAuth();const { mutateAsync: updateToken } = useUpdateIdentityTokenAuthToken();+ const scopeVariant = useScopeVariant();const [token, setToken] = useState("");- const [copyTextToken, isCopyingToken, setCopyTextToken] = useTimedReset<string>({+ const [, isCopyingToken, setCopyTextToken] = useTimedReset<string>({initialState: "Copy to clipboard"});const hasToken = Boolean(token);@@ -71,10 +76,16 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {}}, [popUp?.token?.data]);+ const handleOpenChange = (isOpen: boolean) => {+ handlePopUpToggle("token", isOpen);+ if (!isOpen) {+ reset();+ setToken("");+ }+ };+const onFormSubmit = async ({ name }: FormData) => {if (tokenData?.tokenId) {- // update-await updateToken({identityId: tokenData.identityId,tokenId: tokenData.tokenId,@@ -83,8 +94,6 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {handlePopUpToggle("token", false);} else {- // create-const newTokenData = await createToken({identityId: tokenData.identityId,name@@ -101,69 +110,77 @@ export const IdentityTokenModal = ({ popUp, handlePopUpToggle }: Props) => {reset();};+ const isUpdate = Boolean(tokenData?.tokenId);+return (- <Modal- isOpen={popUp?.token?.isOpen}- onOpenChange={(isOpen) => {- handlePopUpToggle("token", isOpen);- reset();- setToken("");- }}- >- <ModalContent- title={`${tokenData?.tokenId ? "Update" : "Create"} Access Token`}- subTitle={hasToken ? "We will only show this token once" : ""}- >+ <Dialog open={popUp?.token?.isOpen} onOpenChange={handleOpenChange}>+ <DialogContent className="max-w-xl">+ <DialogHeader>+ <DialogTitle>{isUpdate ? "Update Access Token" : "Create Access Token"}</DialogTitle>+ {hasToken && <DialogDescription>We will only show this token once</DialogDescription>}+ </DialogHeader>{!hasToken ? (- <form onSubmit={handleSubmit(onFormSubmit)}>+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-4"><Controllercontrol={control}defaultValue=""name="name"render={({ field, fieldState: { error } }) => (- <FormControl label="Name" isError={Boolean(error)} errorText={error?.message}>- <Input {...field} placeholder="My Token" />- </FormControl>+ <Field>+ <FieldLabel htmlFor="token-name">Name</FieldLabel>+ <Input+ {...field}+ id="token-name"+ placeholder="My Token"+ isError={Boolean(error)}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>)}/>- <div className="flex items-center">+ <DialogFooter>+ <Button type="button" variant="ghost" onClick={() => handleOpenChange(false)}>+ Cancel+ </Button><Button- className="mr-4"- size="sm"type="submit"- isLoading={isSubmitting}+ variant={scopeVariant}+ isPending={isSubmitting}isDisabled={isSubmitting}>- {tokenData?.name ? "Update" : "Create"}+ {isUpdate ? "Update" : "Create"}</Button>- <Button- colorSchema="secondary"- variant="plain"- onClick={() => handlePopUpToggle("token", false)}- >- Cancel- </Button>- </div>+ </DialogFooter></form>) : (- <div className="mt-2 mr-2 mb-3 flex items-center justify-end rounded-md bg-white/[0.07] p-2 text-base text-gray-400">- <p className="mr-4 break-all">{token}</p>- <Tooltip content={copyTextToken}>+ <>+ <div className="relative flex items-center justify-between rounded-md border border-border bg-container p-2 pr-5 pl-3 text-base text-label">+ <p className="mr-4 break-all">{token}</p><IconButton- ariaLabel="copy icon"- colorSchema="secondary"- className="group relative"+ aria-label="copy icon"+ variant="ghost-muted"+ size="sm"+ className="absolute top-1 right-1"onClick={() => {navigator.clipboard.writeText(token);setCopyTextToken("Copied");}}>- <FontAwesomeIcon icon={isCopyingToken ? faCheck : faCopy} />+ {isCopyingToken ? (+ <ClipboardCheck className="size-4" />+ ) : (+ <Copy className="size-4" />+ )}</IconButton>- </Tooltip>- </div>+ </div>+ <DialogFooter>+ <Button type="button" variant="ghost" onClick={() => handleOpenChange(false)}>+ Close+ </Button>+ </DialogFooter>+ </>)}- </ModalContent>- </Modal>+ </DialogContent>+ </Dialog>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityAuthLockoutFields.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityAuthLockoutFields.tsxdeleted file mode 100644index d1bca37875..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityAuthLockoutFields.tsx+++ /dev/null@@ -1,94 +0,0 @@-import { useState } from "react";-import { subject } from "@casl/ability";-import { UseMutationResult } from "@tanstack/react-query";-import { useParams } from "@tanstack/react-router";-import ms from "ms";--import { createNotification } from "@app/components/notifications";-import { VariablePermissionCan } from "@app/components/permissions";-import { Button } from "@app/components/v2";-import {- OrgPermissionIdentityActions,- OrgPermissionSubjects,- ProjectPermissionIdentityActions,- ProjectPermissionSub-} from "@app/context";--import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";--export const LockoutFields = ({- clearLockoutsResult,- lockedOut,- identityId,- data,- onResetAllLockouts-}: {- clearLockoutsResult: UseMutationResult<number, object, { identityId: string }, unknown>;- lockedOut: boolean;- identityId: string;- data: {- lockoutEnabled: boolean;- lockoutThreshold: number;- lockoutDurationSeconds: number;- lockoutCounterResetSeconds: number;- };- onResetAllLockouts: () => void;-}) => {- const { mutateAsync, isPending } = clearLockoutsResult;-- const [lockedOutState, setLockedOutState] = useState(lockedOut);-- const { projectId } = useParams({- strict: false- });-- async function clearLockouts() {- const deleted = await mutateAsync({ identityId });- createNotification({- text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,- type: "success"- });- setLockedOutState(false);- onResetAllLockouts();- }-- return (- <>- <div className="col-span-2 mt-3 flex justify-between border-b border-mineshaft-500 pb-2">- <span className="text-bunker-300">Lockout Options</span>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Button- isDisabled={!isAllowed || !lockedOutState || isPending}- size="xs"- onClick={() => clearLockouts()}- isLoading={isPending}- colorSchema="secondary"- >- Reset All Lockouts- </Button>- )}- </VariablePermissionCan>- </div>- <IdentityAuthFieldDisplay label="Lockout Threshold">- {data.lockoutThreshold}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Lockout Duration">- {ms(data.lockoutDurationSeconds * 1000, { long: true })}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Lockout Counter Reset">- {ms(data.lockoutCounterResetSeconds * 1000, { long: true })}- </IdentityAuthFieldDisplay>- </>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityTokenAuthTokensTable.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityTokenAuthTokensTable.tsxdeleted file mode 100644index 5d7bf30e9e..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityTokenAuthTokensTable.tsx+++ /dev/null@@ -1,273 +0,0 @@-import { useState } from "react";-import { subject } from "@casl/ability";-import { faBan, faEdit, faKey, faPlus } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { useParams } from "@tanstack/react-router";-import { format } from "date-fns";--import { createNotification } from "@app/components/notifications";-import { VariablePermissionCan } from "@app/components/permissions";-import {- Button,- DeleteActionModal,- EmptyState,- IconButton,- Pagination,- Table,- TableContainer,- TBody,- Td,- Th,- THead,- Tooltip,- Tr-} from "@app/components/v2";-import { CopyButton } from "@app/components/v2/CopyButton";-import {- OrgPermissionIdentityActions,- OrgPermissionSubjects,- ProjectPermissionIdentityActions,- ProjectPermissionSub-} from "@app/context";-import { usePopUp } from "@app/hooks";-import { useRevokeIdentityTokenAuthToken } from "@app/hooks/api";-import { IdentityAccessToken } from "@app/hooks/api/identities/types";-import { IdentityTokenModal } from "@app/pages/organization/IdentityDetailsByIDPage/components";--type Props = {- tokens: IdentityAccessToken[];- identityId: string;-};--export const IdentityTokenAuthTokensTable = ({ tokens, identityId }: Props) => {- const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([- "token",- "revokeToken"- ] as const);-- const { projectId } = useParams({- strict: false- });-- const [page, setPage] = useState(1);- const [perPage, setPerPage] = useState(5);-- const { mutateAsync: revokeToken } = useRevokeIdentityTokenAuthToken();-- const onRevokeTokenSubmit = async ({- identityId: parentIdentityId,- tokenId,- name- }: {- identityId: string;- tokenId: string;- name: string;- }) => {- await revokeToken({- identityId: parentIdentityId,- tokenId- });-- handlePopUpClose("revokeToken");-- createNotification({- text: `Successfully revoked token ${name ?? ""}`,- type: "success"- });- };-- return (- <div className="col-span-2 mt-3">- <div className="flex items-end justify-between border-b border-mineshaft-500 pb-2">- <span className="text-bunker-300">Access Tokens</span>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Button- size="xs"- isDisabled={!isAllowed}- onClick={() => {- handlePopUpOpen("token", {- identityId- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- colorSchema="secondary"- >- Add Token- </Button>- )}- </VariablePermissionCan>- </div>- <TableContainer className="mt-4 rounded-none border-none">- <Table>- {Boolean(tokens?.length) && (- <THead>- <Tr className="text-xs font-medium">- <Th className="py-1 font-normal">Name</Th>- <Th className="py-1 font-normal whitespace-nowrap">Number of Uses</Th>- <Th className="py-1 font-normal">Expires</Th>- <Th className="w-5 py-1 font-normal" />- </Tr>- </THead>- )}- <TBody>- {tokens- .slice((page - 1) * perPage, perPage * page)- .map(- ({- createdAt,- isAccessTokenRevoked,- name,- accessTokenTTL,- accessTokenNumUsesLimit,- accessTokenNumUses,- id- }) => {- let expiresAt;- if (accessTokenTTL > 0) {- expiresAt = new Date(new Date(createdAt).getTime() + accessTokenTTL * 1000);- }-- return (- <Tr className="text-xs hover:bg-mineshaft-700" key={id}>- <Td>{name || "-"}</Td>- <Td>- {`${accessTokenNumUses}${accessTokenNumUsesLimit ? `/${accessTokenNumUsesLimit}` : ""}`}- </Td>- <Td className="whitespace-nowrap">- {/* eslint-disable-next-line no-nested-ternary */}- {isAccessTokenRevoked- ? "Revoked"- : expiresAt- ? format(expiresAt, "yyyy-MM-dd")- : "-"}- </Td>- <Td>- <div className="flex items-center gap-2">- <CopyButton value={id} size="xs" variant="plain" name="Token ID" />- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Edit- : OrgPermissionIdentityActions.Edit- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Tooltip content={isAllowed ? "Edit Token" : "Access Restricted"}>- <IconButton- isDisabled={!isAllowed}- onClick={() => {- handlePopUpOpen("token", {- identityId,- tokenId: id,- name- });- }}- size="xs"- variant="plain"- ariaLabel="Edit token"- >- <FontAwesomeIcon icon={faEdit} />- </IconButton>- </Tooltip>- )}- </VariablePermissionCan>- {!isAccessTokenRevoked && (- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Edit- : OrgPermissionIdentityActions.Edit- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Tooltip content={isAllowed ? "Revoke Token" : "Access Restricted"}>- <IconButton- isDisabled={!isAllowed}- onClick={() => {- handlePopUpOpen("revokeToken", {- identityId,- tokenId: id,- name- });- }}- size="xs"- colorSchema="danger"- variant="plain"- ariaLabel="Revoke token"- >- <FontAwesomeIcon icon={faBan} />- </IconButton>- </Tooltip>- )}- </VariablePermissionCan>- )}- </div>- </Td>- </Tr>- );- }- )}- </TBody>- </Table>- {!tokens?.length && (- <EmptyState iconSize="1x" title="No access tokens have been generated" icon={faKey} />- )}- {tokens.length > 0 && (- <Pagination- count={tokens.length}- page={page}- perPage={perPage}- perPageList={[5]}- onChangePage={(newPage) => setPage(newPage)}- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}- />- )}- </TableContainer>- <DeleteActionModal- isOpen={popUp.revokeToken.isOpen}- title={`Are you sure you want to revoke ${- (popUp?.revokeToken?.data as { name: string })?.name || ""- }?`}- onChange={(isOpen) => handlePopUpToggle("revokeToken", isOpen)}- deleteKey="confirm"- onDeleteApproved={() => {- const revokeTokenData = popUp?.revokeToken?.data as {- identityId: string;- tokenId: string;- name: string;- };-- return onRevokeTokenSubmit(revokeTokenData);- }}- />- <IdentityTokenModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />- </div>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityUniversalAuthClientSecretsTable.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityUniversalAuthClientSecretsTable.tsxdeleted file mode 100644index cfecb5f3cc..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityUniversalAuthClientSecretsTable.tsx+++ /dev/null@@ -1,220 +0,0 @@-import { useState } from "react";-import { subject } from "@casl/ability";-import { faKey, faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { useParams } from "@tanstack/react-router";-import { format } from "date-fns";--import { createNotification } from "@app/components/notifications";-import { VariablePermissionCan } from "@app/components/permissions";-import {- Button,- DeleteActionModal,- EmptyState,- IconButton,- Pagination,- Table,- TableContainer,- TBody,- Td,- Th,- THead,- Tooltip,- Tr-} from "@app/components/v2";-import {- OrgPermissionIdentityActions,- OrgPermissionSubjects,- ProjectPermissionIdentityActions,- ProjectPermissionSub-} from "@app/context";-import { usePopUp } from "@app/hooks";-import { useRevokeIdentityUniversalAuthClientSecret } from "@app/hooks/api";-import { ClientSecretData } from "@app/hooks/api/identities/types";-import { IdentityClientSecretModal } from "@app/pages/organization/IdentityDetailsByIDPage/components";--type Props = {- clientSecrets: ClientSecretData[];- identityId: string;-};--export const IdentityUniversalAuthClientSecretsTable = ({ clientSecrets, identityId }: Props) => {- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([- "revokeClientSecret",- "clientSecret"- ] as const);-- const { projectId } = useParams({- strict: false- });-- const [page, setPage] = useState(1);- const [perPage, setPerPage] = useState(5);-- const { mutateAsync: revokeClientSecret } = useRevokeIdentityUniversalAuthClientSecret();-- const onDeleteClientSecretSubmit = async (clientSecretId: string) => {- await revokeClientSecret({- identityId,- clientSecretId- });-- handlePopUpToggle("revokeClientSecret", false);-- createNotification({- text: "Successfully deleted client secret",- type: "success"- });- };-- return (- <div className="col-span-2">- <div className="flex items-end justify-between border-b border-mineshaft-500 pb-2">- <span className="text-bunker-300">Client Secrets</span>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Button- isDisabled={!isAllowed}- size="xs"- onClick={() => {- handlePopUpOpen("clientSecret", {- identityId- });- }}- leftIcon={<FontAwesomeIcon icon={faPlus} />}- colorSchema="secondary"- >- Add Client Secret- </Button>- )}- </VariablePermissionCan>- </div>- <TableContainer className="mt-4 rounded-none border-none">- <Table>- {Boolean(clientSecrets?.length) && (- <THead>- <Tr className="text-xs font-medium">- <Th className="py-1 font-normal">Secret</Th>- <Th className="py-1 font-normal">Description</Th>- <Th className="py-1 font-normal whitespace-nowrap">Number of Uses</Th>- <Th className="py-1 font-normal">Expires</Th>- <Th className="w-5 py-1 font-normal" />- </Tr>- </THead>- )}- <TBody>- {clientSecrets- .slice((page - 1) * perPage, perPage * page)- .map(- ({- createdAt,- clientSecretTTL,- description,- clientSecretNumUses,- clientSecretPrefix,- clientSecretNumUsesLimit,- id- }) => {- let expiresAt;- if (clientSecretTTL > 0) {- expiresAt = new Date(new Date(createdAt).getTime() + clientSecretTTL * 1000);- }-- return (- <Tr className="text-xs hover:bg-mineshaft-700" key={id}>- <Td>{clientSecretPrefix}***</Td>- <Td>{description || "-"}</Td>- <Td>- {`${clientSecretNumUses}${clientSecretNumUsesLimit ? `/${clientSecretNumUsesLimit}` : ""}`}- </Td>- <Td className="whitespace-nowrap">- {expiresAt ? format(expiresAt, "yyyy-MM-dd") : "-"}- </Td>- <Td>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Edit- : OrgPermissionIdentityActions.Edit- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <Tooltip content={isAllowed ? "Delete Secret" : "Access Restricted"}>- <IconButton- isDisabled={!isAllowed}- onClick={() => {- handlePopUpOpen("revokeClientSecret", {- clientSecretPrefix,- clientSecretId: id- });- }}- size="xs"- colorSchema="danger"- variant="plain"- ariaLabel="Delete secret"- >- <FontAwesomeIcon icon={faTrash} />- </IconButton>- </Tooltip>- )}- </VariablePermissionCan>- </Td>- </Tr>- );- }- )}- </TBody>- </Table>- {!clientSecrets?.length && (- <EmptyState iconSize="1x" title="No client secrets have been generated" icon={faKey} />- )}- {clientSecrets.length > 0 && (- <Pagination- count={clientSecrets.length}- page={page}- perPage={perPage}- perPageList={[5]}- onChangePage={(newPage) => setPage(newPage)}- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}- />- )}- </TableContainer>- <DeleteActionModal- isOpen={popUp.revokeClientSecret.isOpen}- title={`Are you sure you want to delete the client secret ${- (popUp?.revokeClientSecret?.data as { clientSecretPrefix: string })?.clientSecretPrefix ||- ""- }************?`}- onChange={(isOpen) => handlePopUpToggle("revokeClientSecret", isOpen)}- deleteKey="confirm"- onDeleteApproved={() => {- const deleteClientSecretData = popUp?.revokeClientSecret?.data as {- clientSecretId: string;- clientSecretPrefix: string;- };-- return onDeleteClientSecretSubmit(deleteClientSecretData.clientSecretId);- }}- />- <IdentityClientSecretModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />- </div>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAuth.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAuth.tsxdeleted file mode 100644index e300c3be31..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAuth.tsx+++ /dev/null@@ -1,336 +0,0 @@-import { subject } from "@casl/ability";-import { useParams } from "@tanstack/react-router";-import { EllipsisIcon, LockIcon } from "lucide-react";--import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";-import { createNotification } from "@app/components/notifications";-import { VariablePermissionCan } from "@app/components/permissions";-import { DeleteActionModal, Modal, ModalContent, Tooltip } from "@app/components/v2";-import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,- Badge,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- IconButton-} from "@app/components/v3";-import {- OrgPermissionIdentityActions,- OrgPermissionSubjects,- ProjectPermissionIdentityActions,- ProjectPermissionSub,- useOrganization-} from "@app/context";-import { MAX_IDENTITY_ACCESS_TOKEN_TTL_FALLBACK } from "@app/helpers/identityAuthSchemas";-import { usePopUp } from "@app/hooks";-import {- IdentityAuthMethod,- identityAuthToNameMap,- useDeleteIdentityAliCloudAuth,- useDeleteIdentityAwsAuth,- useDeleteIdentityAzureAuth,- useDeleteIdentityGcpAuth,- useDeleteIdentityJwtAuth,- useDeleteIdentityKubernetesAuth,- useDeleteIdentityLdapAuth,- useDeleteIdentityOciAuth,- useDeleteIdentityOidcAuth,- useDeleteIdentitySpiffeAuth,- useDeleteIdentityTlsCertAuth,- useDeleteIdentityTokenAuth,- useDeleteIdentityUniversalAuth,- useFetchServerStatus-} from "@app/hooks/api";-import { IdentityAliCloudAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAliCloudAuthForm";-import { IdentityAwsAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAwsAuthForm";-import { IdentityAzureAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAzureAuthForm";-import { IdentityGcpAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityGcpAuthForm";-import { IdentityJwtAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityJwtAuthForm";-import { IdentityKubernetesAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityKubernetesAuthForm";-import { IdentityLdapAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityLdapAuthForm";-import { IdentityOciAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOciAuthForm";-import { IdentityOidcAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityOidcAuthForm";-import { IdentitySpiffeAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySpiffeAuthForm";-import { IdentityTlsCertAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm";-import { IdentityTokenAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTokenAuthForm";-import { IdentityUniversalAuthForm } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityUniversalAuthForm";--import { ViewIdentityAliCloudAuthContent } from "./ViewIdentityAliCloudAuthContent";-import { ViewIdentityAwsAuthContent } from "./ViewIdentityAwsAuthContent";-import { ViewIdentityAzureAuthContent } from "./ViewIdentityAzureAuthContent";-import { ViewIdentityGcpAuthContent } from "./ViewIdentityGcpAuthContent";-import { ViewIdentityJwtAuthContent } from "./ViewIdentityJwtAuthContent";-import { ViewIdentityKubernetesAuthContent } from "./ViewIdentityKubernetesAuthContent";-import { ViewIdentityLdapAuthContent } from "./ViewIdentityLdapAuthContent";-import { ViewIdentityOciAuthContent } from "./ViewIdentityOciAuthContent";-import { ViewIdentityOidcAuthContent } from "./ViewIdentityOidcAuthContent";-import { ViewIdentitySpiffeAuthContent } from "./ViewIdentitySpiffeAuthContent";-import { ViewIdentityTlsCertAuthContent } from "./ViewIdentityTlsCertAuthContent";-import { ViewIdentityTokenAuthContent } from "./ViewIdentityTokenAuthContent";-import { ViewIdentityUniversalAuthContent } from "./ViewIdentityUniversalAuthContent";--type Props = {- identityId: string;- authMethods: IdentityAuthMethod[];- onResetAllLockouts: () => void;- activeLockoutAuthMethods: IdentityAuthMethod[];-};--const AuthMethodComponentMap = {- [IdentityAuthMethod.UNIVERSAL_AUTH]: ViewIdentityUniversalAuthContent,- [IdentityAuthMethod.TOKEN_AUTH]: ViewIdentityTokenAuthContent,- [IdentityAuthMethod.TLS_CERT_AUTH]: ViewIdentityTlsCertAuthContent,- [IdentityAuthMethod.KUBERNETES_AUTH]: ViewIdentityKubernetesAuthContent,- [IdentityAuthMethod.LDAP_AUTH]: ViewIdentityLdapAuthContent,- [IdentityAuthMethod.OCI_AUTH]: ViewIdentityOciAuthContent,- [IdentityAuthMethod.OIDC_AUTH]: ViewIdentityOidcAuthContent,- [IdentityAuthMethod.GCP_AUTH]: ViewIdentityGcpAuthContent,- [IdentityAuthMethod.AWS_AUTH]: ViewIdentityAwsAuthContent,- [IdentityAuthMethod.ALICLOUD_AUTH]: ViewIdentityAliCloudAuthContent,- [IdentityAuthMethod.AZURE_AUTH]: ViewIdentityAzureAuthContent,- [IdentityAuthMethod.JWT_AUTH]: ViewIdentityJwtAuthContent,- [IdentityAuthMethod.SPIFFE_AUTH]: ViewIdentitySpiffeAuthContent-};--const EditAuthMethodMap = {- [IdentityAuthMethod.KUBERNETES_AUTH]: IdentityKubernetesAuthForm,- [IdentityAuthMethod.GCP_AUTH]: IdentityGcpAuthForm,- [IdentityAuthMethod.TLS_CERT_AUTH]: IdentityTlsCertAuthForm,- [IdentityAuthMethod.AWS_AUTH]: IdentityAwsAuthForm,- [IdentityAuthMethod.AZURE_AUTH]: IdentityAzureAuthForm,- [IdentityAuthMethod.ALICLOUD_AUTH]: IdentityAliCloudAuthForm,- [IdentityAuthMethod.UNIVERSAL_AUTH]: IdentityUniversalAuthForm,- [IdentityAuthMethod.TOKEN_AUTH]: IdentityTokenAuthForm,- [IdentityAuthMethod.OCI_AUTH]: IdentityOciAuthForm,- [IdentityAuthMethod.OIDC_AUTH]: IdentityOidcAuthForm,- [IdentityAuthMethod.JWT_AUTH]: IdentityJwtAuthForm,- [IdentityAuthMethod.LDAP_AUTH]: IdentityLdapAuthForm,- [IdentityAuthMethod.SPIFFE_AUTH]: IdentitySpiffeAuthForm-};--export const Content = ({- identityId,- authMethods,- onResetAllLockouts,- activeLockoutAuthMethods-}: Pick<- Props,- "authMethods" | "identityId" | "onResetAllLockouts" | "activeLockoutAuthMethods"->) => {- const { currentOrg } = useOrganization();- const orgId = currentOrg?.id || "";- const { projectId } = useParams({- strict: false- });- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([- "revokeAuthMethod",- "identityAuthMethod",- "upgradePlan"- ] as const);-- const { mutateAsync: revokeUniversalAuth } = useDeleteIdentityUniversalAuth();- const { mutateAsync: revokeTokenAuth } = useDeleteIdentityTokenAuth();- const { mutateAsync: revokeKubernetesAuth } = useDeleteIdentityKubernetesAuth();- const { mutateAsync: revokeGcpAuth } = useDeleteIdentityGcpAuth();- const { mutateAsync: revokeTlsCertAuth } = useDeleteIdentityTlsCertAuth();- const { mutateAsync: revokeAwsAuth } = useDeleteIdentityAwsAuth();- const { mutateAsync: revokeAzureAuth } = useDeleteIdentityAzureAuth();- const { mutateAsync: revokeAliCloudAuth } = useDeleteIdentityAliCloudAuth();- const { mutateAsync: revokeOciAuth } = useDeleteIdentityOciAuth();- const { mutateAsync: revokeOidcAuth } = useDeleteIdentityOidcAuth();- const { mutateAsync: revokeJwtAuth } = useDeleteIdentityJwtAuth();- const { mutateAsync: revokeSpiffeAuth } = useDeleteIdentitySpiffeAuth();- const { mutateAsync: revokeLdapAuth } = useDeleteIdentityLdapAuth();-- const { data: serverStatus } = useFetchServerStatus();- const maxAccessTokenTTL =- serverStatus?.maxIdentityAccessTokenTTL ?? MAX_IDENTITY_ACCESS_TOKEN_TTL_FALLBACK;-- const RemoveAuthMethodMap = {- [IdentityAuthMethod.KUBERNETES_AUTH]: revokeKubernetesAuth,- [IdentityAuthMethod.GCP_AUTH]: revokeGcpAuth,- [IdentityAuthMethod.TLS_CERT_AUTH]: revokeTlsCertAuth,- [IdentityAuthMethod.AWS_AUTH]: revokeAwsAuth,- [IdentityAuthMethod.AZURE_AUTH]: revokeAzureAuth,- [IdentityAuthMethod.ALICLOUD_AUTH]: revokeAliCloudAuth,- [IdentityAuthMethod.UNIVERSAL_AUTH]: revokeUniversalAuth,- [IdentityAuthMethod.TOKEN_AUTH]: revokeTokenAuth,- [IdentityAuthMethod.OCI_AUTH]: revokeOciAuth,- [IdentityAuthMethod.OIDC_AUTH]: revokeOidcAuth,- [IdentityAuthMethod.JWT_AUTH]: revokeJwtAuth,- [IdentityAuthMethod.SPIFFE_AUTH]: revokeSpiffeAuth,- [IdentityAuthMethod.LDAP_AUTH]: revokeLdapAuth- };-- const handleDeleteAuthMethod = async (authMethod: IdentityAuthMethod) => {- await RemoveAuthMethodMap[authMethod]({- identityId,- ...(projectId- ? { projectId }- : {- organizationId: orgId- })- });-- createNotification({- text: "Successfully removed auth method",- type: "success"- });- handlePopUpToggle("revokeAuthMethod", false);- };-- const EditForm = popUp.identityAuthMethod?.data- ? EditAuthMethodMap[popUp.identityAuthMethod.data as IdentityAuthMethod]- : null;-- return (- <>- <Accordion type={authMethods.length === 1 ? "single" : "multiple"} collapsible>- {authMethods.map((authMethod) => {- const Component = AuthMethodComponentMap[authMethod];-- return (- <AccordionItem key={authMethod} value={authMethod}>- <AccordionTrigger>- <span className="mr-auto">{identityAuthToNameMap[authMethod]}</span>- {activeLockoutAuthMethods?.includes(authMethod) && (- <Tooltip content="Auth method has active lockouts">- <Badge isSquare variant="danger">- <LockIcon />- </Badge>- </Tooltip>- )}- <DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton variant="ghost" size="xs">- <EllipsisIcon />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Edit- : OrgPermissionIdentityActions.Edit- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <DropdownMenuItem- isDisabled={!isAllowed}- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("identityAuthMethod", authMethod);- }}- >- Edit Auth Method- </DropdownMenuItem>- )}- </VariablePermissionCan>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Delete- : OrgPermissionIdentityActions.Delete- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <DropdownMenuItem- isDisabled={!isAllowed}- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("revokeAuthMethod", authMethod);- }}- variant="danger"- >- Remove Auth Method- </DropdownMenuItem>- )}- </VariablePermissionCan>- </DropdownMenuContent>- </DropdownMenu>- </AccordionTrigger>- <AccordionContent>- <Component- identityId={identityId}- onEdit={() => handlePopUpOpen("identityAuthMethod", authMethod)}- onDelete={() => handlePopUpOpen("revokeAuthMethod", authMethod)}- onResetAllLockouts={onResetAllLockouts}- lockedOut={activeLockoutAuthMethods?.includes(authMethod)}- />- </AccordionContent>- </AccordionItem>- );- })}- </Accordion>- <DeleteActionModal- isOpen={popUp?.revokeAuthMethod?.isOpen}- title={`Are you sure you want to remove ${popUp?.revokeAuthMethod?.data ? identityAuthToNameMap[popUp?.revokeAuthMethod?.data as IdentityAuthMethod] : "this auth method"} on this identity?`}- onChange={(isOpen) => handlePopUpToggle("revokeAuthMethod", isOpen)}- deleteKey="confirm"- buttonText="Remove"- onDeleteApproved={() =>- handleDeleteAuthMethod(popUp?.revokeAuthMethod?.data as IdentityAuthMethod)- }- />- <Modal- isOpen={popUp?.identityAuthMethod?.isOpen}- onOpenChange={(isOpen) => handlePopUpToggle("identityAuthMethod", isOpen)}- >- <ModalContent- title={`Edit ${popUp?.identityAuthMethod?.data ? identityAuthToNameMap[popUp?.identityAuthMethod?.data as IdentityAuthMethod] : "this auth method"}`}- >- {EditForm && (- <EditForm- identityId={identityId}- isUpdate- maxAccessTokenTTL={maxAccessTokenTTL}- handlePopUpOpen={handlePopUpOpen}- handlePopUpToggle={handlePopUpToggle}- />- )}- </ModalContent>- </Modal>- <UpgradePlanModal- isOpen={popUp.upgradePlan.isOpen}- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}- text={`Your current plan does not include access to ${popUp.upgradePlan.data?.featureName}. To unlock this feature, please upgrade to Infisical ${popUp.upgradePlan.data?.isEnterpriseFeature ? "Enterprise" : "Pro"} plan.`}- />- </>- );-};--export const ViewIdentityAuth = ({- authMethods,- identityId,- onResetAllLockouts,- activeLockoutAuthMethods-}: Props) => {- return (- <Content- identityId={identityId}- authMethods={authMethods}- activeLockoutAuthMethods={activeLockoutAuthMethods}- onResetAllLockouts={() => onResetAllLockouts()}- />- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper.tsxdeleted file mode 100644index f3a4cb3690..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper.tsx+++ /dev/null@@ -1,109 +0,0 @@-import { ReactNode } from "react";-import { subject } from "@casl/ability";-import { faChevronDown, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { useParams } from "@tanstack/react-router";--import { VariablePermissionCan } from "@app/components/permissions";-import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger-} from "@app/components/v2";-import {- OrgPermissionIdentityActions,- OrgPermissionSubjects,- ProjectPermissionIdentityActions,- ProjectPermissionSub-} from "@app/context";--type Props = {- children: ReactNode;- onEdit: VoidFunction;- onDelete: VoidFunction;- identityId: string;-};--export const ViewIdentityContentWrapper = ({ children, onDelete, onEdit, identityId }: Props) => {- const { projectId } = useParams({- strict: false- });-- return (- <div className="flex flex-col gap-4">- <div>- <div className="flex items-end justify-between border-b border-mineshaft-500 pb-2">- <span className="text-bunker-300">Details</span>- <div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button- size="xs"- rightIcon={<FontAwesomeIcon className="ml-1" icon={faChevronDown} />}- colorSchema="secondary"- >- Options- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="mt-3 min-w-[120px]" align="end">- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Edit- : OrgPermissionIdentityActions.Edit- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <DropdownMenuItem- isDisabled={!isAllowed}- onClick={onEdit}- icon={<FontAwesomeIcon icon={faEdit} />}- >- Edit- </DropdownMenuItem>- )}- </VariablePermissionCan>- <VariablePermissionCan- type={projectId ? "project" : "org"}- I={- projectId- ? ProjectPermissionIdentityActions.Delete- : OrgPermissionIdentityActions.Delete- }- a={- projectId- ? subject(ProjectPermissionSub.Identity, {- identityId- })- : OrgPermissionSubjects.Identity- }- >- {(isAllowed) => (- <DropdownMenuItem- isDisabled={!isAllowed}- onClick={onDelete}- icon={<FontAwesomeIcon icon={faTrash} />}- >- Delete- </DropdownMenuItem>- )}- </VariablePermissionCan>- </DropdownMenuContent>- </DropdownMenu>- </div>- </div>- <div className="mt-3 grid grid-cols-2 gap-3">{children}</div>- </div>- </div>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityLdapAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityLdapAuthContent.tsxdeleted file mode 100644index c835fd97cf..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityLdapAuthContent.tsx+++ /dev/null@@ -1,101 +0,0 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { EyeIcon } from "lucide-react";--import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { useClearIdentityLdapAuthLockouts, useGetIdentityLdapAuth } from "@app/hooks/api";-import { ViewIdentityContentWrapper } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper";--import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { LockoutFields } from "./IdentityAuthLockoutFields";-import { ViewAuthMethodProps } from "./types";--export const ViewIdentityLdapAuthContent = ({- identityId,- onDelete,- onEdit,- lockedOut,- onResetAllLockouts-}: ViewAuthMethodProps) => {- const { data, isPending } = useGetIdentityLdapAuth(identityId);- const clearLockoutsResult = useClearIdentityLdapAuthLockouts();-- if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );- }-- if (!data) {- return (- <EmptyState icon={faBan} title="Could not find LDAP Auth associated with this Identity." />- );- }-- return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>- <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">- {data.accessTokenTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">- {data.accessTokenMaxTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">- {data.accessTokenNumUsesLimit}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Trusted IPs">- {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="LDAP URL">{data.url}</IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Bind DN">{data.bindDN}</IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Bind Pass">- <Tooltip- side="right"- className="max-w-xl p-2"- content={<p className="rounded-sm bg-mineshaft-600 p-2 break-words">{data.bindPass}</p>}- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>- </Tooltip>- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Search Base / DN">- {data.searchBase}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Search Filter">{data.searchFilter}</IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="CA Certificate">- {data.ldapCaCertificate && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words">- {data.ldapCaCertificate}- </p>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>- </Tooltip>- )}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Lockout">- {data.lockoutEnabled ? "Enabled" : "Disabled"}- </IdentityAuthFieldDisplay>- {data.lockoutEnabled && (- <LockoutFields- identityId={identityId}- lockedOut={lockedOut}- clearLockoutsResult={clearLockoutsResult}- data={data}- onResetAllLockouts={onResetAllLockouts}- />- )}- </ViewIdentityContentWrapper>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTlsCertAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTlsCertAuthContent.tsxdeleted file mode 100644index 6ffefbeb6f..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTlsCertAuthContent.tsx+++ /dev/null@@ -1,72 +0,0 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { EyeIcon } from "lucide-react";--import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";-import { useGetIdentityTlsCertAuth } from "@app/hooks/api";--import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";--export const ViewIdentityTlsCertAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {- const { data, isPending } = useGetIdentityTlsCertAuth(identityId);-- if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );- }-- if (!data) {- return (- <EmptyState- icon={faBan}- title="Could not find TLS Certificate Auth associated with this Identity."- />- );- }-- return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>- <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">- {data.accessTokenTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">- {data.accessTokenMaxTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">- {data.accessTokenNumUsesLimit}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Trusted IPs">- {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay className="col-span-2" label="CA Certificate">- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words">{data.caCertificate}</p>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>- </Tooltip>- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay className="col-span-2" label="Allowed Common Names">- {data.allowedCommonNames- ?.split(",")- .map((cn) => cn.trim())- .join(", ")}- </IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTokenAuthContent.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTokenAuthContent.tsxdeleted file mode 100644index b86a4d9ad2..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityTokenAuthContent.tsx+++ /dev/null@@ -1,51 +0,0 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";--import { EmptyState, Spinner } from "@app/components/v2";-import { useGetIdentityTokenAuth, useGetIdentityTokensTokenAuth } from "@app/hooks/api";--import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { IdentityTokenAuthTokensTable } from "./IdentityTokenAuthTokensTable";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";--export const ViewIdentityTokenAuthContent = ({- identityId,- onDelete,- onEdit-}: ViewAuthMethodProps) => {- const { data, isPending } = useGetIdentityTokenAuth(identityId);- const { data: tokens = [], isPending: clientSecretsPending } =- useGetIdentityTokensTokenAuth(identityId);-- if (isPending || clientSecretsPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );- }-- if (!data) {- return (- <EmptyState icon={faBan} title="Could not find Token Auth associated with this Identity." />- );- }-- return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>- <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">- {data.accessTokenTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">- {data.accessTokenMaxTTL}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">- {data.accessTokenNumUsesLimit}- </IdentityAuthFieldDisplay>- <IdentityAuthFieldDisplay label="Access Token Trusted IPs">- {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}- </IdentityAuthFieldDisplay>- <IdentityTokenAuthTokensTable tokens={tokens} identityId={identityId} />- </ViewIdentityContentWrapper>- );-};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/index.ts b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/index.tsdeleted file mode 100644index 951c840876..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./ViewIdentityAuth";diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/types/index.ts b/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/types/index.tsdeleted file mode 100644index e4b0154109..0000000000--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/types/index.ts+++ /dev/null@@ -1,7 +0,0 @@-export type ViewAuthMethodProps = {- identityId: string;- onDelete: () => void;- onEdit: () => void;- lockedOut: boolean;- onResetAllLockouts: () => void;-};diff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsxindex 9ecd4aa7c9..fff9850189 100644--- a/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx+++ b/frontend/src/pages/pam/PamDiscoveryPage/components/PamDiscoverySourceForm/GenericDiscoveryFields.tsx@@ -67,7 +67,6 @@ export const GenericDiscoveryFields = () => {<FieldContent><GatewayPickerisRequired- variant="v3"placeholder="Select a Gateway..."value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {diff --git a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsxindex 42aa807837..324b2048ed 100644--- a/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx+++ b/frontend/src/pages/pam/PamResourcesPage/components/PamResourceForm/GenericResourceFields.tsx@@ -55,7 +55,6 @@ export const GenericResourceFields = () => {<FieldContent><GatewayPickerisRequired- variant="v3"placeholder="Select a Gateway..."value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsxindex 4c2391ef17..4a5180705a 100644--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx@@ -5,6 +5,7 @@ import {ChevronDownIcon,FilterIcon,InfoIcon,+ LockIcon,MoreHorizontalIcon,PlusIcon,SearchIcon,@@ -37,6 +38,9 @@ import {DropdownMenuContent,DropdownMenuItem,DropdownMenuLabel,+ DropdownMenuSub,+ DropdownMenuSubContent,+ DropdownMenuSubTrigger,DropdownMenuTrigger,Empty,EmptyDescription,@@ -80,6 +84,8 @@ import {import { withProjectPermission } from "@app/hoc";import { usePagination, useResetPageHelper } from "@app/hooks";import {+ IdentityAuthMethod,+ identityAuthToNameMap,useDeleteProjectIdentity,useDeleteProjectIdentityMembership,useGetProjectRoles,@@ -88,7 +94,9 @@ import {import { OrderByDirection } from "@app/hooks/api/generic/types";import { ProjectIdentityOrderBy, ProjectType } from "@app/hooks/api/projects/types";import { usePopUp } from "@app/hooks/usePopUp";+import { IdentityAuthMethodModal } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal";import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal";+import { IdentityAuthMethodSheet } from "@app/views/IdentityAuthMethods";import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal";@@ -149,7 +157,7 @@ export const IdentityTab = withProjectPermission([]);- const { data, isPending, isFetching } = useListProjectIdentityMemberships(+ const { data, isPending, isFetching, refetch } = useListProjectIdentityMemberships({projectId,projectType: currentProject?.type,@@ -178,9 +186,15 @@ export const IdentityTab = withProjectPermission("createIdentity","deleteIdentity","upgradePlan",- "addOptions"+ "addOptions",+ "identityAuthMethod"] as const);+ const [viewAuthMethodState, setViewAuthMethodState] = useState<{+ identityId: string;+ authMethod: IdentityAuthMethod;+ } | null>(null);+const onRemoveIdentitySubmit = async (identityId: string, isProjectIdentity: boolean) => {if (isProjectIdentity) {await deleteProjectIdentity({@@ -322,7 +336,7 @@ export const IdentityTab = withProjectPermission(<TableHeader><TableRow><TableHead- className="w-1/3"+ className="w-1/4"onClick={() => handleSort(ProjectIdentityOrderBy.Name)}>Name@@ -336,7 +350,7 @@ export const IdentityTab = withProjectPermission()}/></TableHead>- <TableHead className="w-1/3">+ <TableHead className="w-1/4">{isCertManager ? "Role" : `${productLabel} Role`}</TableHead><TableHead>Managed by</TableHead>@@ -372,7 +386,9 @@ export const IdentityTab = withProjectPermission(id,name,projectId: identityProjectId,- orgId: identityOrgId+ orgId: identityOrgId,+ authMethods,+ activeLockoutAuthMethods},roles} = identityMember;@@ -440,49 +456,122 @@ export const IdentityTab = withProjectPermission(</Badge></TableCell><TableCell>- <DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton- variant="ghost"- size="xs"- onClick={(e) => e.stopPropagation()}- >- <MoreHorizontalIcon />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent sideOffset={2} align="end">- <ProjectPermissionCan- I={ProjectPermissionActions.Delete}- a={subject(ProjectPermissionSub.Identity, {- identityId: id- })}- >- {(isAllowed) => (- <DropdownMenuItem- variant="danger"- isDisabled={!isAllowed}- onClick={(evt) => {- evt.stopPropagation();- evt.preventDefault();- handlePopUpOpen("deleteIdentity", {- identityId: id,- name,- isProjectIdentity: Boolean(identityProjectId)- });- }}- >- {identityProjectId ? <TrashIcon /> : <XIcon />}- {/* eslint-disable-next-line no-nested-ternary */}- {identityProjectId- ? "Delete Machine Identity"- : isCertManager- ? "Remove From Certificate Manager"- : "Remove From Project"}- </DropdownMenuItem>+ <div className="flex items-center justify-end gap-2">+ {(activeLockoutAuthMethods?.length ?? 0) > 0 && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge isSquare variant="danger">+ <LockIcon />+ </Badge>+ </TooltipTrigger>+ <TooltipContent>+ {`Locked out: ${(activeLockoutAuthMethods ?? [])+ .map((m) => identityAuthToNameMap[m])+ .join(", ")}`}+ </TooltipContent>+ </Tooltip>+ )}+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ variant="ghost"+ size="xs"+ onClick={(e) => e.stopPropagation()}+ >+ <MoreHorizontalIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent sideOffset={2} align="end">+ {identityProjectId && (+ <DropdownMenuSub>+ <DropdownMenuSubTrigger chevronOnLeft>+ Manage Auth Methods+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent>+ {(authMethods ?? []).map((method) => (+ <DropdownMenuItem+ key={method}+ onClick={(evt) => {+ evt.stopPropagation();+ evt.preventDefault();+ setViewAuthMethodState({+ identityId: id,+ authMethod: method+ });+ }}+ >+ {identityAuthToNameMap[method]}+ {activeLockoutAuthMethods?.includes(method) && (+ <Badge+ isSquare+ variant="danger"+ className="ml-auto"+ >+ <LockIcon className="size-3!" />+ </Badge>+ )}+ </DropdownMenuItem>+ ))}+ <ProjectPermissionCan+ I={ProjectPermissionActions.Edit}+ a={subject(ProjectPermissionSub.Identity, {+ identityId: id+ })}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ onClick={(evt) => {+ evt.stopPropagation();+ evt.preventDefault();+ handlePopUpOpen("identityAuthMethod", {+ identityId: id,+ name,+ allAuthMethods: authMethods ?? []+ });+ }}+ >+ <PlusIcon />+ Add Auth Method+ </DropdownMenuItem>+ )}+ </ProjectPermissionCan>+ </DropdownMenuSubContent>+ </DropdownMenuSub>)}- </ProjectPermissionCan>- </DropdownMenuContent>- </DropdownMenu>+ <ProjectPermissionCan+ I={ProjectPermissionActions.Delete}+ a={subject(ProjectPermissionSub.Identity, {+ identityId: id+ })}+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={(evt) => {+ evt.stopPropagation();+ evt.preventDefault();+ handlePopUpOpen("deleteIdentity", {+ identityId: id,+ name,+ isProjectIdentity: Boolean(identityProjectId)+ });+ }}+ >+ {identityProjectId ? <TrashIcon /> : <XIcon />}+ {/* eslint-disable-next-line no-nested-ternary */}+ {identityProjectId+ ? "Delete Machine Identity"+ : isCertManager+ ? "Remove From Certificate Manager"+ : "Remove From Project"}+ </DropdownMenuItem>+ )}+ </ProjectPermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </div></TableCell></TableRow>);@@ -493,7 +582,7 @@ export const IdentityTab = withProjectPermission(Array.from(Array(noAccessIdentityCount)).map((_e, i) => (<TableRow key={`hid-identity-${i + 1}`}><TableCell>No Access</TableCell>- <TableCell colSpan={3}>+ <TableCell colSpan={4}><BlurclassName="w-min"tooltipText="You do not have permission to view this machine identity."@@ -600,6 +689,36 @@ export const IdentityTab = withProjectPermission()}/>+ <IdentityAuthMethodModal+ popUp={popUp}+ handlePopUpOpen={handlePopUpOpen}+ handlePopUpToggle={handlePopUpToggle}+ />+ {viewAuthMethodState &&+ (() => {+ const viewedIdentity = data?.identityMemberships?.find(+ (m) => m.identity.id === viewAuthMethodState.identityId+ )?.identity;+ if (!viewedIdentity) return null;+ return (+ <IdentityAuthMethodSheet+ open+ onOpenChange={(open) => {+ if (!open) setViewAuthMethodState(null);+ }}+ identityId={viewAuthMethodState.identityId}+ identityName={viewedIdentity.name}+ authMethod={viewAuthMethodState.authMethod}+ allAuthMethods={viewedIdentity.authMethods ?? []}+ isLockedOut={+ viewedIdentity.activeLockoutAuthMethods?.includes(+ viewAuthMethodState.authMethod+ ) ?? false+ }+ onMutated={refetch}+ />+ );+ })()}</>);},diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsxindex db651af9d3..944c9ba72e 100644--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx@@ -21,7 +21,7 @@ import { ProjectPermissionIdentityActions, ProjectPermissionSub } from "@app/conimport { IdentityAuthMethod, TProjectIdentity } from "@app/hooks/api";import { usePopUp } from "@app/hooks/usePopUp";import { IdentityAuthMethodModal } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal";-import { ViewIdentityAuth } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth";+import { IdentityAuthMethodsTable } from "@app/views/IdentityAuthMethods";type Props = {identity: TProjectIdentity;@@ -31,8 +31,7 @@ type Props = {export const ProjectIdentityAuthenticationSection = ({ identity, refetchIdentity }: Props) => {const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp(["identityAuthMethod",- "upgradePlan",- "revokeAuthMethod"+ "upgradePlan"]);const hasAuthMethods = Boolean(identity.authMethods.length);@@ -78,11 +77,12 @@ export const ProjectIdentityAuthenticationSection = ({ identity, refetchIdentity</CardHeader><CardContent>{identity.authMethods.length > 0 ? (- <ViewIdentityAuth- authMethods={identity.authMethods}+ <IdentityAuthMethodsTableidentityId={identity.id}- onResetAllLockouts={refetchIdentity}+ identityName={identity.name}+ authMethods={identity.authMethods}activeLockoutAuthMethods={identity.activeLockoutAuthMethods}+ onMutated={refetchIdentity}/>) : (<Empty className="border">diff --git a/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodSheet.tsx b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodSheet.tsxnew file mode 100644index 0000000000..55ad16f221--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodSheet.tsx@@ -0,0 +1,327 @@+import { useEffect, useState } from "react";+import { subject } from "@casl/ability";+import { useParams } from "@tanstack/react-router";+import { LockIcon, Trash2Icon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import { VariablePermissionCan } from "@app/components/permissions";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Badge,+ Button,+ Field,+ FieldContent,+ FieldLabel,+ Input,+ Sheet,+ SheetContent,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import {+ OrgPermissionIdentityActions,+ OrgPermissionSubjects,+ ProjectPermissionIdentityActions,+ ProjectPermissionSub,+ useOrganization+} from "@app/context";+import { usePopUp, useScopeVariant } from "@app/hooks";+import {+ IdentityAuthMethod,+ identityAuthToNameMap,+ useDeleteIdentityAliCloudAuth,+ useDeleteIdentityAwsAuth,+ useDeleteIdentityAzureAuth,+ useDeleteIdentityGcpAuth,+ useDeleteIdentityJwtAuth,+ useDeleteIdentityKubernetesAuth,+ useDeleteIdentityLdapAuth,+ useDeleteIdentityOciAuth,+ useDeleteIdentityOidcAuth,+ useDeleteIdentitySpiffeAuth,+ useDeleteIdentityTlsCertAuth,+ useDeleteIdentityTokenAuth,+ useDeleteIdentityUniversalAuth+} from "@app/hooks/api";+import { IdentityAuthMethodModal } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal";++import {+ IdentityAliCloudAuthContent,+ IdentityAwsAuthContent,+ IdentityAzureAuthContent,+ IdentityGcpAuthContent,+ IdentityJwtAuthContent,+ IdentityKubernetesAuthContent,+ IdentityLdapAuthContent,+ IdentityOciAuthContent,+ IdentityOidcAuthContent,+ IdentitySpiffeAuthContent,+ IdentityTlsCertAuthContent,+ IdentityTokenAuthContent,+ IdentityUniversalAuthContent+} from "./content";+import { ViewAuthMethodProps } from "./types";++const AuthMethodComponentMap: Record<+ IdentityAuthMethod,+ React.ComponentType<ViewAuthMethodProps>+> = {+ [IdentityAuthMethod.UNIVERSAL_AUTH]: IdentityUniversalAuthContent,+ [IdentityAuthMethod.TOKEN_AUTH]: IdentityTokenAuthContent,+ [IdentityAuthMethod.TLS_CERT_AUTH]: IdentityTlsCertAuthContent,+ [IdentityAuthMethod.KUBERNETES_AUTH]: IdentityKubernetesAuthContent,+ [IdentityAuthMethod.LDAP_AUTH]: IdentityLdapAuthContent,+ [IdentityAuthMethod.OCI_AUTH]: IdentityOciAuthContent,+ [IdentityAuthMethod.OIDC_AUTH]: IdentityOidcAuthContent,+ [IdentityAuthMethod.GCP_AUTH]: IdentityGcpAuthContent,+ [IdentityAuthMethod.AWS_AUTH]: IdentityAwsAuthContent,+ [IdentityAuthMethod.ALICLOUD_AUTH]: IdentityAliCloudAuthContent,+ [IdentityAuthMethod.AZURE_AUTH]: IdentityAzureAuthContent,+ [IdentityAuthMethod.JWT_AUTH]: IdentityJwtAuthContent,+ [IdentityAuthMethod.SPIFFE_AUTH]: IdentitySpiffeAuthContent+};++type Props = {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ identityId: string;+ identityName: string;+ authMethod: IdentityAuthMethod;+ allAuthMethods: IdentityAuthMethod[];+ isLockedOut: boolean;+ onMutated: () => void;+};++type RevokeArgs = { identityId: string; projectId?: string; organizationId?: string };+type RevokeFn = (args: RevokeArgs) => Promise<unknown>;++export const IdentityAuthMethodSheet = ({+ open,+ onOpenChange,+ identityId,+ identityName,+ authMethod,+ allAuthMethods,+ isLockedOut,+ onMutated+}: Props) => {+ const { projectId } = useParams({ strict: false });+ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";+ const scopeVariant = useScopeVariant();++ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([+ "revokeAuthMethod",+ "identityAuthMethod",+ "upgradePlan"+ ] as const);++ const [removeConfirmInput, setRemoveConfirmInput] = useState("");+ const isRemoveDialogOpen = popUp.revokeAuthMethod.isOpen;++ useEffect(() => {+ if (!isRemoveDialogOpen) setRemoveConfirmInput("");+ }, [isRemoveDialogOpen]);++ const isRemoveConfirmed = removeConfirmInput === "confirm";++ const { mutateAsync: revokeUniversal } = useDeleteIdentityUniversalAuth();+ const { mutateAsync: revokeToken } = useDeleteIdentityTokenAuth();+ const { mutateAsync: revokeKubernetes } = useDeleteIdentityKubernetesAuth();+ const { mutateAsync: revokeGcp } = useDeleteIdentityGcpAuth();+ const { mutateAsync: revokeTlsCert } = useDeleteIdentityTlsCertAuth();+ const { mutateAsync: revokeAws } = useDeleteIdentityAwsAuth();+ const { mutateAsync: revokeAzure } = useDeleteIdentityAzureAuth();+ const { mutateAsync: revokeAliCloud } = useDeleteIdentityAliCloudAuth();+ const { mutateAsync: revokeOci } = useDeleteIdentityOciAuth();+ const { mutateAsync: revokeOidc } = useDeleteIdentityOidcAuth();+ const { mutateAsync: revokeJwt } = useDeleteIdentityJwtAuth();+ const { mutateAsync: revokeSpiffe } = useDeleteIdentitySpiffeAuth();+ const { mutateAsync: revokeLdap } = useDeleteIdentityLdapAuth();++ const revokeMap: Record<IdentityAuthMethod, RevokeFn> = {+ [IdentityAuthMethod.UNIVERSAL_AUTH]: revokeUniversal as RevokeFn,+ [IdentityAuthMethod.TOKEN_AUTH]: revokeToken as RevokeFn,+ [IdentityAuthMethod.KUBERNETES_AUTH]: revokeKubernetes as RevokeFn,+ [IdentityAuthMethod.GCP_AUTH]: revokeGcp as RevokeFn,+ [IdentityAuthMethod.TLS_CERT_AUTH]: revokeTlsCert as RevokeFn,+ [IdentityAuthMethod.AWS_AUTH]: revokeAws as RevokeFn,+ [IdentityAuthMethod.AZURE_AUTH]: revokeAzure as RevokeFn,+ [IdentityAuthMethod.ALICLOUD_AUTH]: revokeAliCloud as RevokeFn,+ [IdentityAuthMethod.OCI_AUTH]: revokeOci as RevokeFn,+ [IdentityAuthMethod.OIDC_AUTH]: revokeOidc as RevokeFn,+ [IdentityAuthMethod.JWT_AUTH]: revokeJwt as RevokeFn,+ [IdentityAuthMethod.SPIFFE_AUTH]: revokeSpiffe as RevokeFn,+ [IdentityAuthMethod.LDAP_AUTH]: revokeLdap as RevokeFn+ };++ const handleDelete = async () => {+ if (!isRemoveConfirmed) return;++ await revokeMap[authMethod]({+ identityId,+ ...(projectId ? { projectId } : { organizationId: orgId })+ });++ createNotification({+ text: "Successfully removed auth method",+ type: "success"+ });+ handlePopUpToggle("revokeAuthMethod", false);+ onMutated();+ onOpenChange(false);+ };++ const Content = AuthMethodComponentMap[authMethod];++ const isEditOpen = Boolean(popUp.identityAuthMethod.isOpen);++ return (+ <>+ <Sheet open={open && !isEditOpen} onOpenChange={onOpenChange}>+ <SheetContent side="right" className="flex flex-col sm:max-w-2xl">+ <SheetHeader className="border-b pr-12">+ <SheetTitle className="flex items-center gap-2">+ {identityAuthToNameMap[authMethod]}+ {isLockedOut && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge isSquare variant="danger">+ <LockIcon />+ </Badge>+ </TooltipTrigger>+ <TooltipContent>Auth method has active lockouts</TooltipContent>+ </Tooltip>+ )}+ </SheetTitle>+ </SheetHeader>+ <div className="flex thin-scrollbar flex-1 flex-col overflow-y-auto px-4 pb-4">+ <Content identityId={identityId} isLockedOut={isLockedOut} onMutated={onMutated} />+ </div>+ <SheetFooter className="justify-between border-t">+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Edit+ : OrgPermissionIdentityActions.Edit+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, { identityId })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <Button+ isDisabled={!isAllowed}+ variant={scopeVariant}+ onClick={() =>+ handlePopUpOpen("identityAuthMethod", {+ identityId,+ name: identityName,+ allAuthMethods,+ authMethod+ })+ }+ >+ Edit+ </Button>+ )}+ </VariablePermissionCan>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Delete+ : OrgPermissionIdentityActions.Delete+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, { identityId })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <Button+ isDisabled={!isAllowed}+ variant="danger"+ onClick={() => handlePopUpOpen("revokeAuthMethod")}+ >+ Remove+ </Button>+ )}+ </VariablePermissionCan>+ </SheetFooter>++ <AlertDialog+ open={isRemoveDialogOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("revokeAuthMethod", isOpen)}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <Trash2Icon />+ </AlertDialogMedia>+ <AlertDialogTitle>+ Are you sure you want to remove {identityAuthToNameMap[authMethod]} on this+ identity?+ </AlertDialogTitle>+ <AlertDialogDescription>This action is irreversible.</AlertDialogDescription>+ </AlertDialogHeader>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ handleDelete();+ }}+ >+ <Field>+ <FieldLabel htmlFor="remove-auth-confirm">+ Type <span className="font-bold text-foreground">confirm</span> to perform this+ action+ </FieldLabel>+ <FieldContent>+ <Input+ id="remove-auth-confirm"+ value={removeConfirmInput}+ onChange={(e) => setRemoveConfirmInput(e.target.value)}+ placeholder="Type confirm here"+ autoComplete="off"+ />+ </FieldContent>+ </Field>+ </form>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={handleDelete}+ isDisabled={!isRemoveConfirmed}+ >+ Remove+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </SheetContent>+ </Sheet>+ <IdentityAuthMethodModal+ popUp={popUp}+ handlePopUpOpen={handlePopUpOpen}+ handlePopUpToggle={handlePopUpToggle}+ />+ </>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsCell.tsx b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsCell.tsxnew file mode 100644index 0000000000..d57f3ff888--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsCell.tsx@@ -0,0 +1,75 @@+import { useState } from "react";+import { LockIcon } from "lucide-react";++import { Badge, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";+import { IdentityAuthMethod, identityAuthToNameMap } from "@app/hooks/api";++import { IdentityAuthMethodSheet } from "./IdentityAuthMethodSheet";++type Props = {+ identityId: string;+ identityName: string;+ authMethods: IdentityAuthMethod[];+ activeLockoutAuthMethods: IdentityAuthMethod[];+ onMutated: () => void;+};++export const IdentityAuthMethodsCell = ({+ identityId,+ identityName,+ authMethods,+ activeLockoutAuthMethods,+ onMutated+}: Props) => {+ const [selectedAuthMethod, setSelectedAuthMethod] = useState<IdentityAuthMethod | null>(null);++ if (!authMethods?.length) {+ return <span className="text-muted">—</span>;+ }++ return (+ <>+ <div className="flex flex-wrap items-center gap-1">+ {authMethods.map((authMethod) => {+ const isLockedOut = activeLockoutAuthMethods?.includes(authMethod);+ const badge = (+ <Badge asChild variant={isLockedOut ? "danger" : "neutral"} className="cursor-pointer">+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ setSelectedAuthMethod(authMethod);+ }}+ >+ {isLockedOut && <LockIcon />}+ {identityAuthToNameMap[authMethod]}+ </button>+ </Badge>+ );+ return isLockedOut ? (+ <Tooltip key={authMethod}>+ <TooltipTrigger asChild>{badge}</TooltipTrigger>+ <TooltipContent>Auth method has active lockouts</TooltipContent>+ </Tooltip>+ ) : (+ <span key={authMethod}>{badge}</span>+ );+ })}+ </div>+ {selectedAuthMethod && (+ <IdentityAuthMethodSheet+ open={selectedAuthMethod !== null}+ onOpenChange={(open) => {+ if (!open) setSelectedAuthMethod(null);+ }}+ identityId={identityId}+ identityName={identityName}+ authMethod={selectedAuthMethod}+ allAuthMethods={authMethods}+ isLockedOut={activeLockoutAuthMethods?.includes(selectedAuthMethod) ?? false}+ onMutated={onMutated}+ />+ )}+ </>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsTable.tsx b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsTable.tsxnew file mode 100644index 0000000000..8be3a6f567--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/IdentityAuthMethodsTable.tsx@@ -0,0 +1,205 @@+import { useState } from "react";+import { subject } from "@casl/ability";+import { useParams } from "@tanstack/react-router";+import { EllipsisIcon, EyeIcon, LockIcon, PencilIcon, Trash2Icon } from "lucide-react";++import { VariablePermissionCan } from "@app/components/permissions";+import {+ Badge,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ IconButton,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import {+ OrgPermissionIdentityActions,+ OrgPermissionSubjects,+ ProjectPermissionIdentityActions,+ ProjectPermissionSub+} from "@app/context";+import { usePopUp } from "@app/hooks";+import { IdentityAuthMethod, identityAuthToNameMap } from "@app/hooks/api";+import { IdentityAuthMethodModal } from "@app/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal";++import { IdentityAuthRevokeDialog } from "./helpers";+import { IdentityAuthMethodSheet } from "./IdentityAuthMethodSheet";++type Props = {+ identityId: string;+ identityName: string;+ authMethods: IdentityAuthMethod[];+ activeLockoutAuthMethods: IdentityAuthMethod[];+ onMutated: () => void;+};++export const IdentityAuthMethodsTable = ({+ identityId,+ identityName,+ authMethods,+ activeLockoutAuthMethods,+ onMutated+}: Props) => {+ const [selectedAuthMethod, setSelectedAuthMethod] = useState<IdentityAuthMethod | null>(null);+ const [revokeAuthMethod, setRevokeAuthMethod] = useState<IdentityAuthMethod | null>(null);++ const { projectId } = useParams({ strict: false });++ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([+ "identityAuthMethod",+ "upgradePlan"+ ] as const);++ const handleEdit = (authMethod: IdentityAuthMethod) => {+ handlePopUpOpen("identityAuthMethod", {+ identityId,+ name: identityName,+ allAuthMethods: authMethods,+ authMethod+ });+ };++ const handleRevoke = (authMethod: IdentityAuthMethod) => {+ setRevokeAuthMethod(authMethod);+ };++ return (+ <>+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Auth Method</TableHead>+ <TableHead className="w-5" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {authMethods.map((authMethod) => {+ const isLockedOut = activeLockoutAuthMethods?.includes(authMethod);+ return (+ <TableRow+ key={authMethod}+ className="cursor-pointer"+ onClick={() => setSelectedAuthMethod(authMethod)}+ >+ <TableCell>+ <div className="flex items-center gap-2">+ {identityAuthToNameMap[authMethod]}+ {isLockedOut && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge isSquare variant="danger">+ <LockIcon />+ </Badge>+ </TooltipTrigger>+ <TooltipContent>Auth method has active lockouts</TooltipContent>+ </Tooltip>+ )}+ </div>+ </TableCell>+ <TableCell onClick={(e) => e.stopPropagation()}>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton variant="ghost" size="xs" aria-label="Auth method actions">+ <EllipsisIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={() => setSelectedAuthMethod(authMethod)}>+ <EyeIcon />+ View Auth Method+ </DropdownMenuItem>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Edit+ : OrgPermissionIdentityActions.Edit+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, { identityId })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ onClick={() => handleEdit(authMethod)}+ >+ <PencilIcon />+ Edit Auth Method+ </DropdownMenuItem>+ )}+ </VariablePermissionCan>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Delete+ : OrgPermissionIdentityActions.Delete+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, { identityId })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={() => handleRevoke(authMethod)}+ >+ <Trash2Icon />+ Remove Auth Method+ </DropdownMenuItem>+ )}+ </VariablePermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ {selectedAuthMethod && (+ <IdentityAuthMethodSheet+ open={selectedAuthMethod !== null}+ onOpenChange={(open) => {+ if (!open) setSelectedAuthMethod(null);+ }}+ identityId={identityId}+ identityName={identityName}+ authMethod={selectedAuthMethod}+ allAuthMethods={authMethods}+ isLockedOut={activeLockoutAuthMethods?.includes(selectedAuthMethod) ?? false}+ onMutated={onMutated}+ />+ )}+ <IdentityAuthMethodModal+ popUp={popUp}+ handlePopUpOpen={handlePopUpOpen}+ handlePopUpToggle={handlePopUpToggle}+ />+ <IdentityAuthRevokeDialog+ open={revokeAuthMethod !== null}+ onOpenChange={(open) => {+ if (!open) setRevokeAuthMethod(null);+ }}+ identityId={identityId}+ authMethod={revokeAuthMethod}+ onSuccess={onMutated}+ />+ </>+ );+};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAliCloudAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityAliCloudAuthContent.tsxsimilarity index 55%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAliCloudAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityAliCloudAuthContent.tsxindex 30837ea27e..850a05b78b 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAliCloudAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityAliCloudAuthContent.tsx@@ -1,38 +1,33 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";+import { BanIcon } from "lucide-react";-import { EmptyState, Spinner } from "@app/components/v2";+import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";import { useGetIdentityAliCloudAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityAliCloudAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityAliCloudAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityAliCloudAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState- icon={faBan}- title="Could not find Alibaba Cloud Auth associated with this Identity."- />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find Alibaba Cloud Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -51,6 +46,6 @@ export const ViewIdentityAliCloudAuthContent = ({.map((u) => u.trim()).join(", ")}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAwsAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityAwsAuthContent.tsxsimilarity index 63%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAwsAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityAwsAuthContent.tsxindex c16a8c3a14..ff7c8242fa 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAwsAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityAwsAuthContent.tsx@@ -1,35 +1,33 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";+import { BanIcon } from "lucide-react";-import { EmptyState, Spinner } from "@app/components/v2";+import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";import { useGetIdentityAwsAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityAwsAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityAwsAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityAwsAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find AWS Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find AWS Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -57,6 +55,6 @@ export const ViewIdentityAwsAuthContent = ({<IdentityAuthFieldDisplay className="col-span-2" label="STS Endpoint">{data.stsEndpoint}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAzureAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityAzureAuthContent.tsxsimilarity index 62%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAzureAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityAzureAuthContent.tsxindex 5f25f1a508..6889b79eea 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityAzureAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityAzureAuthContent.tsx@@ -1,35 +1,33 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";+import { BanIcon } from "lucide-react";-import { EmptyState, Spinner } from "@app/components/v2";+import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";import { useGetIdentityAzureAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityAzureAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityAzureAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityAzureAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find Azure Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find Azure Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -54,6 +52,6 @@ export const ViewIdentityAzureAuthContent = ({.map((id) => id.trim()).join(", ")}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityGcpAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityGcpAuthContent.tsxsimilarity index 69%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityGcpAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityGcpAuthContent.tsxindex 5f24ec54c5..58299fdd27 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityGcpAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityGcpAuthContent.tsx@@ -1,35 +1,33 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";+import { BanIcon } from "lucide-react";-import { EmptyState, Spinner } from "@app/components/v2";+import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";import { useGetIdentityGcpAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityGcpAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityGcpAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityGcpAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find GCP Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find GCP Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -67,6 +65,6 @@ export const ViewIdentityGcpAuthContent = ({</IdentityAuthFieldDisplay></>)}- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityJwtAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityJwtAuthContent.tsxsimilarity index 58%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityJwtAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityJwtAuthContent.tsxindex a372491eb8..6621cd890b 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityJwtAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityJwtAuthContent.tsx@@ -1,38 +1,44 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { EyeIcon } from "lucide-react";+import { BanIcon, EyeIcon } from "lucide-react";-import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useGetIdentityJwtAuth } from "@app/hooks/api";import { IdentityJwtConfigurationType } from "@app/hooks/api/identities/enums";-import { ViewIdentityContentWrapper } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityJwtAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityJwtAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityJwtAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find JWT Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find JWT Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -55,17 +61,16 @@ export const ViewIdentityJwtAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="JWKS CA Certificate">{data.jwksCaCert && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words">{data.jwksCaCert}</p>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.jwksCaCert}</p>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>@@ -75,20 +80,18 @@ export const ViewIdentityJwtAuthContent = ({{data.publicKeys.length && (<div className="flex flex-wrap gap-1">{data.publicKeys.map((key, index) => (- <Tooltip- side="right"- className="max-w-xl p-2"- key={key}- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words whitespace-normal">+ <Tooltip key={key}>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Key {index + 1}+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words whitespace-normal">{key}</p>- }- >- <Badge variant="neutral">- <EyeIcon />- Key {index + 1}- </Badge>+ </TooltipContent></Tooltip>))}</div>@@ -109,22 +112,21 @@ export const ViewIdentityJwtAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Claims">{Object.keys(data.boundClaims).length && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <pre className="rounded-sm bg-mineshaft-600 p-2 whitespace-pre-wrap">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <pre className="rounded-sm bg-container p-2 whitespace-pre-wrap">{JSON.stringify(data.boundClaims, null, 2)}</pre>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityKubernetesAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityKubernetesAuthContent.tsxsimilarity index 60%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityKubernetesAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityKubernetesAuthContent.tsxindex e6992ca2e7..b7ef90a5bb 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityKubernetesAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityKubernetesAuthContent.tsx@@ -1,21 +1,24 @@import { useMemo } from "react";-import { faBan } from "@fortawesome/free-solid-svg-icons";import { useQuery } from "@tanstack/react-query";-import { EyeIcon } from "lucide-react";+import { BanIcon, EyeIcon } from "lucide-react";-import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { gatewaysQueryKeys, useGetIdentityKubernetesAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityKubernetesAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityKubernetesAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data: gateways } = useQuery(gatewaysQueryKeys.list());const { data, isPending } = useGetIdentityKubernetesAuth(identityId);@@ -25,24 +28,24 @@ export const ViewIdentityKubernetesAuthContent = ({}, [gateways, data?.gatewayId]);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState- icon={faBan}- title="Could not find Kubernetes Auth associated with this Identity."- />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find Kubernetes Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -64,22 +67,21 @@ export const ViewIdentityKubernetesAuthContent = ({<IdentityAuthFieldDisplay label="Gateway">{selectedGateway?.name}</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Token Reviewer JWT">{data.tokenReviewerJwt ? (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.tokenReviewerJwt || "Not provided"}</p>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ </TooltipContent></Tooltip>) : (- <p className="text-base leading-4 text-bunker-400 italic">Not set</p>+ <p className="text-base leading-4 text-muted italic">Not set</p>)}</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Allowed Service Account Names">@@ -99,18 +101,19 @@ export const ViewIdentityKubernetesAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="CA Certificate">{data.caCert && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={<p className="rounded-sm bg-mineshaft-600 p-2 break-words">{data.caCert}</p>}- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.caCert}</p>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/views/IdentityAuthMethods/content/IdentityLdapAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityLdapAuthContent.tsxnew file mode 100644index 0000000000..1a4f063576--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityLdapAuthContent.tsx@@ -0,0 +1,105 @@+import { BanIcon, EyeIcon } from "lucide-react";++import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { IdentityAuthMethod, useGetIdentityLdapAuth } from "@app/hooks/api";++import { IdentityAuthFieldDisplay, IdentityAuthLockoutFields } from "../helpers";+import { ViewAuthMethodProps } from "../types";++export const IdentityLdapAuthContent = ({+ identityId,+ isLockedOut,+ onMutated+}: ViewAuthMethodProps) => {+ const { data, isPending } = useGetIdentityLdapAuth(identityId);++ if (isPending) {+ return <PageLoader />;+ }++ if (!data) {+ return (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find LDAP Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>+ );+ }++ return (+ <div className="grid grid-cols-2 gap-3">+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">+ {data.accessTokenTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">+ {data.accessTokenMaxTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">+ {data.accessTokenNumUsesLimit}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Trusted IPs">+ {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="LDAP URL">{data.url}</IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Bind DN">{data.bindDN}</IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Bind Pass">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.bindPass}</p>+ </TooltipContent>+ </Tooltip>+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Search Base / DN">+ {data.searchBase}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Search Filter">{data.searchFilter}</IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="CA Certificate">+ {data.ldapCaCertificate && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.ldapCaCertificate}</p>+ </TooltipContent>+ </Tooltip>+ )}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Lockout">+ {data.lockoutEnabled ? "Enabled" : "Disabled"}+ </IdentityAuthFieldDisplay>+ {data.lockoutEnabled && (+ <IdentityAuthLockoutFields+ identityId={identityId}+ authMethod={IdentityAuthMethod.LDAP_AUTH}+ isLockedOut={isLockedOut ?? false}+ onResetSuccess={() => onMutated?.()}+ data={data}+ />+ )}+ </div>+ );+};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOciAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityOciAuthContent.tsxsimilarity index 59%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOciAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityOciAuthContent.tsxindex 7b7e582582..94600e13bf 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOciAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityOciAuthContent.tsx@@ -1,35 +1,33 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";+import { BanIcon } from "lucide-react";-import { EmptyState, Spinner } from "@app/components/v2";+import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";import { useGetIdentityOciAuth } from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityOciAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityOciAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityOciAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find OCI Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find OCI Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -51,6 +49,6 @@ export const ViewIdentityOciAuthContent = ({.map((u) => u.trim()).join(", ")}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOidcAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityOidcAuthContent.tsxsimilarity index 53%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOidcAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityOidcAuthContent.tsxindex 27b487a3fe..5907f930d0 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityOidcAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityOidcAuthContent.tsx@@ -1,37 +1,43 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { EyeIcon } from "lucide-react";+import { BanIcon, EyeIcon } from "lucide-react";-import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useGetIdentityOidcAuth } from "@app/hooks/api";-import { ViewIdentityContentWrapper } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityOidcAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentityOidcAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityOidcAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find OIDC Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find OIDC Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay label="Access Token TTL (seconds)">{data.accessTokenTTL}</IdentityAuthFieldDisplay>@@ -52,15 +58,16 @@ export const ViewIdentityOidcAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="CA Certificate">{data.caCert && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={<p className="rounded-sm bg-mineshaft-600 p-2 break-words">{data.caCert}</p>}- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.caCert}</p>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>@@ -75,40 +82,38 @@ export const ViewIdentityOidcAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Claims">{Object.keys(data.boundClaims).length && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <pre className="rounded-sm bg-mineshaft-600 p-2 whitespace-pre-wrap">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <pre className="rounded-sm bg-container p-2 whitespace-pre-wrap">{JSON.stringify(data.boundClaims, null, 2)}</pre>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Claim Metadata Mapping">{data.claimMetadataMapping && Object.keys(data.claimMetadataMapping).length && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <pre className="rounded-sm bg-mineshaft-600 p-2 whitespace-pre-wrap">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <pre className="rounded-sm bg-container p-2 whitespace-pre-wrap">{JSON.stringify(data.claimMetadataMapping, null, 2)}</pre>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentitySpiffeAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentitySpiffeAuthContent.tsxsimilarity index 66%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentitySpiffeAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentitySpiffeAuthContent.tsxindex ccf35b3ae1..5824232852 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentitySpiffeAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentitySpiffeAuthContent.tsx@@ -1,45 +1,51 @@-import { faBan } from "@fortawesome/free-solid-svg-icons";-import { EyeIcon } from "lucide-react";+import { BanIcon, EyeIcon } from "lucide-react";-import { EmptyState, Spinner, Tooltip } from "@app/components/v2";-import { Badge } from "@app/components/v3";+import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useGetIdentitySpiffeAuth } from "@app/hooks/api";import { SpiffeTrustBundleProfile } from "@app/hooks/api/identities/enums";-import { ViewIdentityContentWrapper } from "@app/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityContentWrapper";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { ViewAuthMethodProps } from "./types";+import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";const PROFILE_DISPLAY_MAP: Record<string, string> = {[SpiffeTrustBundleProfile.STATIC]: "Static",[SpiffeTrustBundleProfile.HTTPS_WEB_BUNDLE]: "HTTPS Web Bundle"};-export const ViewIdentitySpiffeAuthContent = ({- identityId,- onEdit,- onDelete-}: ViewAuthMethodProps) => {+export const IdentitySpiffeAuthContent = ({ identityId }: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentitySpiffeAuth(identityId);if (isPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState icon={faBan} title="Could not find SPIFFE Auth associated with this Identity." />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find SPIFFE Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}const { trustBundleDistribution: dist } = data;return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3"><IdentityAuthFieldDisplay className="col-span-2" label="Trust Domain">{data.trustDomain}</IdentityAuthFieldDisplay>@@ -61,19 +67,18 @@ export const ViewIdentitySpiffeAuthContent = ({{dist.profile === SpiffeTrustBundleProfile.STATIC ? (<IdentityAuthFieldDisplay className="col-span-2" label="CA Bundle JWKS">{dist.bundle && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <pre className="rounded-sm bg-mineshaft-600 p-2 break-words whitespace-pre-wrap">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <pre className="rounded-sm bg-container p-2 break-words whitespace-pre-wrap">{dist.bundle}</pre>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>@@ -84,17 +89,16 @@ export const ViewIdentitySpiffeAuthContent = ({</IdentityAuthFieldDisplay><IdentityAuthFieldDisplay className="col-span-2" label="Root CA Certificate">{dist.caCert && (- <Tooltip- side="right"- className="max-w-xl p-2"- content={- <p className="rounded-sm bg-mineshaft-600 p-2 break-words">{dist.caCert}</p>- }- >- <Badge variant="neutral">- <EyeIcon />- Reveal- </Badge>+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{dist.caCert}</p>+ </TooltipContent></Tooltip>)}</IdentityAuthFieldDisplay>@@ -120,6 +124,6 @@ export const ViewIdentitySpiffeAuthContent = ({<IdentityAuthFieldDisplay label="Access Token Trusted IPs">{data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}</IdentityAuthFieldDisplay>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsxnew file mode 100644index 0000000000..965d4bb2c8--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx@@ -0,0 +1,76 @@+import { BanIcon, EyeIcon } from "lucide-react";++import {+ Badge,+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { useGetIdentityTlsCertAuth } from "@app/hooks/api";++import { IdentityAuthFieldDisplay } from "../helpers";+import { ViewAuthMethodProps } from "../types";++export const IdentityTlsCertAuthContent = ({ identityId }: ViewAuthMethodProps) => {+ const { data, isPending } = useGetIdentityTlsCertAuth(identityId);++ if (isPending) {+ return <PageLoader />;+ }++ if (!data) {+ return (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>+ Could not find TLS Certificate Auth associated with this Identity.+ </EmptyTitle>+ </EmptyHeader>+ </Empty>+ );+ }++ return (+ <div className="grid grid-cols-2 gap-3">+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">+ {data.accessTokenTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">+ {data.accessTokenMaxTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">+ {data.accessTokenNumUsesLimit}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Trusted IPs">+ {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay className="col-span-2" label="CA Certificate">+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <EyeIcon />+ Reveal+ </Badge>+ </TooltipTrigger>+ <TooltipContent side="right" className="max-w-xl p-2">+ <p className="rounded-sm bg-container p-2 break-words">{data.caCertificate}</p>+ </TooltipContent>+ </Tooltip>+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay className="col-span-2" label="Allowed Common Names">+ {data.allowedCommonNames+ ?.split(",")+ .map((cn) => cn.trim())+ .join(", ")}+ </IdentityAuthFieldDisplay>+ </div>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/content/IdentityTokenAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityTokenAuthContent.tsxnew file mode 100644index 0000000000..f3ca59ed4a--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityTokenAuthContent.tsx@@ -0,0 +1,47 @@+import { BanIcon } from "lucide-react";++import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, PageLoader } from "@app/components/v3";+import { useGetIdentityTokenAuth, useGetIdentityTokensTokenAuth } from "@app/hooks/api";++import { IdentityAuthFieldDisplay, IdentityTokenAuthTokensTable } from "../helpers";+import { ViewAuthMethodProps } from "../types";++export const IdentityTokenAuthContent = ({ identityId }: ViewAuthMethodProps) => {+ const { data, isPending } = useGetIdentityTokenAuth(identityId);+ const { data: tokens = [], isPending: tokensPending } = useGetIdentityTokensTokenAuth(identityId);++ if (isPending || tokensPending) {+ return <PageLoader />;+ }++ if (!data) {+ return (+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find Token Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>+ );+ }++ return (+ <div className="grid grid-cols-2 gap-3">+ <IdentityAuthFieldDisplay label="Access Token TTL (seconds)">+ {data.accessTokenTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max TTL (seconds)">+ {data.accessTokenMaxTTL}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Max Number of Uses">+ {data.accessTokenNumUsesLimit}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Access Token Trusted IPs">+ {data.accessTokenTrustedIps.map((ip) => ip.ipAddress).join(", ")}+ </IdentityAuthFieldDisplay>+ <IdentityTokenAuthTokensTable tokens={tokens} identityId={identityId} />+ </div>+ );+};diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityUniversalAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityUniversalAuthContent.tsxsimilarity index 53%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityUniversalAuthContent.tsxrename to frontend/src/views/IdentityAuthMethods/content/IdentityUniversalAuthContent.tsxindex 86a2e4fb9a..a2cd0f3359 100644--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/ViewIdentityUniversalAuthContent.tsx+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityUniversalAuthContent.tsx@@ -1,55 +1,62 @@-import { faBan, faCheck, faCopy } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { BanIcon, CheckIcon, CopyIcon } from "lucide-react";-import { EmptyState, IconButton, Spinner, Tooltip } from "@app/components/v2";+import {+ Empty,+ EmptyHeader,+ EmptyMedia,+ EmptyTitle,+ IconButton,+ PageLoader,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";import { useTimedReset } from "@app/hooks";import {- useClearIdentityUniversalAuthLockouts,+ IdentityAuthMethod,useGetIdentityUniversalAuth,useGetIdentityUniversalAuthClientSecrets} from "@app/hooks/api";-import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";-import { LockoutFields } from "./IdentityAuthLockoutFields";-import { IdentityUniversalAuthClientSecretsTable } from "./IdentityUniversalAuthClientSecretsTable";-import { ViewAuthMethodProps } from "./types";-import { ViewIdentityContentWrapper } from "./ViewIdentityContentWrapper";+import {+ IdentityAuthFieldDisplay,+ IdentityAuthLockoutFields,+ IdentityUniversalAuthClientSecretsTable+} from "../helpers";+import { ViewAuthMethodProps } from "../types";-export const ViewIdentityUniversalAuthContent = ({+export const IdentityUniversalAuthContent = ({identityId,- onDelete,- onEdit,- lockedOut,- onResetAllLockouts+ isLockedOut,+ onMutated}: ViewAuthMethodProps) => {const { data, isPending } = useGetIdentityUniversalAuth(identityId);const { data: clientSecrets = [], isPending: clientSecretsPending } =useGetIdentityUniversalAuthClientSecrets(identityId);- const clearLockoutsResult = useClearIdentityUniversalAuthLockouts();const [copyTextClientId, isCopyingClientId, setCopyTextClientId] = useTimedReset<string>({initialState: "Copy Client ID to clipboard"});if (isPending || clientSecretsPending) {- return (- <div className="flex w-full items-center justify-center">- <Spinner className="text-mineshaft-400" />- </div>- );+ return <PageLoader />;}if (!data) {return (- <EmptyState- icon={faBan}- title="Could not find Universal Auth associated with this Identity."- />+ <Empty className="border">+ <EmptyHeader>+ <EmptyMedia variant="icon">+ <BanIcon />+ </EmptyMedia>+ <EmptyTitle>Could not find Universal Auth associated with this Identity.</EmptyTitle>+ </EmptyHeader>+ </Empty>);}return (- <ViewIdentityContentWrapper onEdit={onEdit} onDelete={onDelete} identityId={identityId}>+ <div className="grid grid-cols-2 gap-3">{Number(data.accessTokenPeriod) > 0 ? (<IdentityAuthFieldDisplay label="Access Token Period (seconds)">{data.accessTokenPeriod}@@ -77,31 +84,33 @@ export const ViewIdentityUniversalAuthContent = ({{data.lockoutEnabled ? "Enabled" : "Disabled"}</IdentityAuthFieldDisplay>{data.lockoutEnabled && (- <LockoutFields+ <IdentityAuthLockoutFieldsidentityId={identityId}- lockedOut={lockedOut}- clearLockoutsResult={clearLockoutsResult}+ authMethod={IdentityAuthMethod.UNIVERSAL_AUTH}+ isLockedOut={isLockedOut ?? false}+ onResetSuccess={() => onMutated?.()}data={data}- onResetAllLockouts={onResetAllLockouts}/>)}- <div className="col-span-2 my-3">- <div className="mb-3 border-b border-mineshaft-500 pb-2">- <span className="text-bunker-300">Client ID</span>- </div>+ <div className="col-span-2 my-3 flex flex-col gap-2">+ <div className="border-b border-border pb-2 text-foreground">Client ID</div><div className="flex items-center gap-2"><span className="text-sm">{data.clientId}</span>- <Tooltip content={copyTextClientId}>- <IconButton- ariaLabel="copy icon"- variant="plain"- onClick={() => {- navigator.clipboard.writeText(data.clientId);- setCopyTextClientId("Copied");- }}- >- <FontAwesomeIcon icon={isCopyingClientId ? faCheck : faCopy} />- </IconButton>+ <Tooltip>+ <TooltipTrigger asChild>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Copy Client ID"+ onClick={() => {+ navigator.clipboard.writeText(data.clientId);+ setCopyTextClientId("Copied");+ }}+ >+ {isCopyingClientId ? <CheckIcon /> : <CopyIcon />}+ </IconButton>+ </TooltipTrigger>+ <TooltipContent>{copyTextClientId}</TooltipContent></Tooltip></div></div>@@ -109,6 +118,6 @@ export const ViewIdentityUniversalAuthContent = ({clientSecrets={clientSecrets}identityId={identityId}/>- </ViewIdentityContentWrapper>+ </div>);};diff --git a/frontend/src/views/IdentityAuthMethods/content/index.ts b/frontend/src/views/IdentityAuthMethods/content/index.tsnew file mode 100644index 0000000000..4b908813f9--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/content/index.ts@@ -0,0 +1,13 @@+export { IdentityAliCloudAuthContent } from "./IdentityAliCloudAuthContent";+export { IdentityAwsAuthContent } from "./IdentityAwsAuthContent";+export { IdentityAzureAuthContent } from "./IdentityAzureAuthContent";+export { IdentityGcpAuthContent } from "./IdentityGcpAuthContent";+export { IdentityJwtAuthContent } from "./IdentityJwtAuthContent";+export { IdentityKubernetesAuthContent } from "./IdentityKubernetesAuthContent";+export { IdentityLdapAuthContent } from "./IdentityLdapAuthContent";+export { IdentityOciAuthContent } from "./IdentityOciAuthContent";+export { IdentityOidcAuthContent } from "./IdentityOidcAuthContent";+export { IdentitySpiffeAuthContent } from "./IdentitySpiffeAuthContent";+export { IdentityTlsCertAuthContent } from "./IdentityTlsCertAuthContent";+export { IdentityTokenAuthContent } from "./IdentityTokenAuthContent";+export { IdentityUniversalAuthContent } from "./IdentityUniversalAuthContent";diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityAuthFieldDisplay.tsx b/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthFieldDisplay.tsxsimilarity index 100%rename from frontend/src/pages/organization/IdentityDetailsByIDPage/components/ViewIdentityAuth/IdentityAuthFieldDisplay.tsxrename to frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthFieldDisplay.tsxdiff --git a/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthLockoutFields.tsx b/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthLockoutFields.tsxnew file mode 100644index 0000000000..5160900d22--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthLockoutFields.tsx@@ -0,0 +1,50 @@+import ms from "ms";++import { IdentityAuthMethod } from "@app/hooks/api";++import { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";+import { ResetLockoutsButton } from "./ResetLockoutsButton";++type Props = {+ identityId: string;+ authMethod: IdentityAuthMethod;+ isLockedOut: boolean;+ onResetSuccess: () => void;+ data: {+ lockoutThreshold: number;+ lockoutDurationSeconds: number;+ lockoutCounterResetSeconds: number;+ };+};++export const IdentityAuthLockoutFields = ({+ identityId,+ authMethod,+ isLockedOut,+ onResetSuccess,+ data+}: Props) => {+ return (+ <>+ <div className="col-span-2 mt-3 flex items-center justify-between border-b border-border pb-2 text-foreground">+ Lockout Options+ {isLockedOut && (+ <ResetLockoutsButton+ identityId={identityId}+ authMethod={authMethod}+ onSuccess={onResetSuccess}+ />+ )}+ </div>+ <IdentityAuthFieldDisplay label="Lockout Threshold">+ {data.lockoutThreshold}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Lockout Duration">+ {ms(data.lockoutDurationSeconds * 1000, { long: true })}+ </IdentityAuthFieldDisplay>+ <IdentityAuthFieldDisplay label="Lockout Counter Reset">+ {ms(data.lockoutCounterResetSeconds * 1000, { long: true })}+ </IdentityAuthFieldDisplay>+ </>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthRevokeDialog.tsx b/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthRevokeDialog.tsxnew file mode 100644index 0000000000..7d9fb4167b--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/IdentityAuthRevokeDialog.tsx@@ -0,0 +1,163 @@+import { useEffect, useState } from "react";+import { useParams } from "@tanstack/react-router";+import { Trash2Icon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Field,+ FieldContent,+ FieldLabel,+ Input+} from "@app/components/v3";+import { useOrganization } from "@app/context";+import {+ IdentityAuthMethod,+ identityAuthToNameMap,+ useDeleteIdentityAliCloudAuth,+ useDeleteIdentityAwsAuth,+ useDeleteIdentityAzureAuth,+ useDeleteIdentityGcpAuth,+ useDeleteIdentityJwtAuth,+ useDeleteIdentityKubernetesAuth,+ useDeleteIdentityLdapAuth,+ useDeleteIdentityOciAuth,+ useDeleteIdentityOidcAuth,+ useDeleteIdentitySpiffeAuth,+ useDeleteIdentityTlsCertAuth,+ useDeleteIdentityTokenAuth,+ useDeleteIdentityUniversalAuth+} from "@app/hooks/api";++type RevokeArgs = { identityId: string; projectId?: string; organizationId?: string };+type RevokeFn = (args: RevokeArgs) => Promise<unknown>;++type Props = {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ identityId: string;+ authMethod: IdentityAuthMethod | null;+ onSuccess: () => void;+};++export const IdentityAuthRevokeDialog = ({+ open,+ onOpenChange,+ identityId,+ authMethod,+ onSuccess+}: Props) => {+ const { projectId } = useParams({ strict: false });+ const { currentOrg } = useOrganization();+ const orgId = currentOrg?.id || "";++ const [removeConfirmInput, setRemoveConfirmInput] = useState("");++ useEffect(() => {+ if (!open) setRemoveConfirmInput("");+ }, [open]);++ const isRemoveConfirmed = removeConfirmInput === "confirm";++ const { mutateAsync: revokeUniversal } = useDeleteIdentityUniversalAuth();+ const { mutateAsync: revokeToken } = useDeleteIdentityTokenAuth();+ const { mutateAsync: revokeKubernetes } = useDeleteIdentityKubernetesAuth();+ const { mutateAsync: revokeGcp } = useDeleteIdentityGcpAuth();+ const { mutateAsync: revokeTlsCert } = useDeleteIdentityTlsCertAuth();+ const { mutateAsync: revokeAws } = useDeleteIdentityAwsAuth();+ const { mutateAsync: revokeAzure } = useDeleteIdentityAzureAuth();+ const { mutateAsync: revokeAliCloud } = useDeleteIdentityAliCloudAuth();+ const { mutateAsync: revokeOci } = useDeleteIdentityOciAuth();+ const { mutateAsync: revokeOidc } = useDeleteIdentityOidcAuth();+ const { mutateAsync: revokeJwt } = useDeleteIdentityJwtAuth();+ const { mutateAsync: revokeSpiffe } = useDeleteIdentitySpiffeAuth();+ const { mutateAsync: revokeLdap } = useDeleteIdentityLdapAuth();++ const revokeMap: Record<IdentityAuthMethod, RevokeFn> = {+ [IdentityAuthMethod.UNIVERSAL_AUTH]: revokeUniversal as RevokeFn,+ [IdentityAuthMethod.TOKEN_AUTH]: revokeToken as RevokeFn,+ [IdentityAuthMethod.KUBERNETES_AUTH]: revokeKubernetes as RevokeFn,+ [IdentityAuthMethod.GCP_AUTH]: revokeGcp as RevokeFn,+ [IdentityAuthMethod.TLS_CERT_AUTH]: revokeTlsCert as RevokeFn,+ [IdentityAuthMethod.AWS_AUTH]: revokeAws as RevokeFn,+ [IdentityAuthMethod.AZURE_AUTH]: revokeAzure as RevokeFn,+ [IdentityAuthMethod.ALICLOUD_AUTH]: revokeAliCloud as RevokeFn,+ [IdentityAuthMethod.OCI_AUTH]: revokeOci as RevokeFn,+ [IdentityAuthMethod.OIDC_AUTH]: revokeOidc as RevokeFn,+ [IdentityAuthMethod.JWT_AUTH]: revokeJwt as RevokeFn,+ [IdentityAuthMethod.SPIFFE_AUTH]: revokeSpiffe as RevokeFn,+ [IdentityAuthMethod.LDAP_AUTH]: revokeLdap as RevokeFn+ };++ const handleDelete = async () => {+ if (!authMethod || !isRemoveConfirmed) return;++ await revokeMap[authMethod]({+ identityId,+ ...(projectId ? { projectId } : { organizationId: orgId })+ });++ createNotification({+ text: "Successfully removed auth method",+ type: "success"+ });+ onOpenChange(false);+ onSuccess();+ };++ return (+ <AlertDialog open={open} onOpenChange={onOpenChange}>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <Trash2Icon />+ </AlertDialogMedia>+ <AlertDialogTitle>+ Are you sure you want to remove{" "}+ {authMethod ? identityAuthToNameMap[authMethod] : "this auth method"} on this identity?+ </AlertDialogTitle>+ <AlertDialogDescription>This action is irreversible.</AlertDialogDescription>+ </AlertDialogHeader>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ handleDelete();+ }}+ >+ <Field>+ <FieldLabel htmlFor="remove-auth-confirm">+ Type <span className="font-bold text-foreground">confirm</span> to perform this action+ </FieldLabel>+ <FieldContent>+ <Input+ id="remove-auth-confirm"+ value={removeConfirmInput}+ onChange={(e) => setRemoveConfirmInput(e.target.value)}+ placeholder="Type confirm here"+ autoComplete="off"+ />+ </FieldContent>+ </Field>+ </form>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={handleDelete}+ isDisabled={!isRemoveConfirmed}+ >+ Remove+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/helpers/IdentityTokenAuthTokensTable.tsx b/frontend/src/views/IdentityAuthMethods/helpers/IdentityTokenAuthTokensTable.tsxnew file mode 100644index 0000000000..970e8eca6b--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/IdentityTokenAuthTokensTable.tsx@@ -0,0 +1,312 @@+import { useState } from "react";+import { subject } from "@casl/ability";+import { useParams } from "@tanstack/react-router";+import { format } from "date-fns";+import { BanIcon, CopyIcon, EllipsisIcon, PencilIcon, PlusIcon, Trash2Icon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import { VariablePermissionCan } from "@app/components/permissions";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyTitle,+ IconButton,+ Pagination,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow+} from "@app/components/v3";+import {+ OrgPermissionIdentityActions,+ OrgPermissionSubjects,+ ProjectPermissionIdentityActions,+ ProjectPermissionSub+} from "@app/context";+import { usePopUp } from "@app/hooks";+import { useRevokeIdentityTokenAuthToken } from "@app/hooks/api";+import { IdentityAccessToken } from "@app/hooks/api/identities/types";+import { IdentityTokenModal } from "@app/pages/organization/IdentityDetailsByIDPage/components";++type Props = {+ tokens: IdentityAccessToken[];+ identityId: string;+};++export const IdentityTokenAuthTokensTable = ({ tokens, identityId }: Props) => {+ const { popUp, handlePopUpOpen, handlePopUpToggle, handlePopUpClose } = usePopUp([+ "token",+ "revokeToken"+ ] as const);++ const { projectId } = useParams({+ strict: false+ });++ const [page, setPage] = useState(1);+ const [perPage, setPerPage] = useState(5);++ const { mutateAsync: revokeToken } = useRevokeIdentityTokenAuthToken();++ const onRevokeTokenSubmit = async ({+ identityId: parentIdentityId,+ tokenId,+ name+ }: {+ identityId: string;+ tokenId: string;+ name: string;+ }) => {+ await revokeToken({+ identityId: parentIdentityId,+ tokenId+ });++ handlePopUpClose("revokeToken");++ createNotification({+ text: `Successfully revoked token ${name ?? ""}`,+ type: "success"+ });+ };++ const revokeTokenData = popUp?.revokeToken?.data as+ | { identityId: string; tokenId: string; name: string }+ | undefined;++ return (+ <div className="col-span-2 mt-3 flex flex-col gap-2">+ <div className="flex items-end justify-between border-b border-border pb-2">+ <span className="text-foreground">Access Tokens</span>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, {+ identityId+ })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <Button+ size="xs"+ variant="outline"+ isDisabled={!isAllowed}+ onClick={() => {+ handlePopUpOpen("token", {+ identityId+ });+ }}+ >+ <PlusIcon />+ Add Token+ </Button>+ )}+ </VariablePermissionCan>+ </div>+ {tokens.length > 0 ? (+ <>+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="w-full" isTruncatable>+ Name+ </TableHead>+ <TableHead>Number of Uses</TableHead>+ <TableHead>Expires</TableHead>+ <TableHead className="w-5" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {tokens.slice((page - 1) * perPage, perPage * page).map((token) => {+ const {+ createdAt,+ isAccessTokenRevoked,+ name,+ accessTokenTTL,+ accessTokenNumUsesLimit,+ accessTokenNumUses,+ id+ } = token;++ let expiresAt: Date | undefined;+ if (accessTokenTTL > 0) {+ expiresAt = new Date(new Date(createdAt).getTime() + accessTokenTTL * 1000);+ }++ return (+ <TableRow key={id}>+ <TableCell isTruncatable>{name || "—"}</TableCell>+ <TableCell>+ {`${accessTokenNumUses}${accessTokenNumUsesLimit ? `/${accessTokenNumUsesLimit}` : ""}`}+ </TableCell>+ <TableCell>+ {/* eslint-disable-next-line no-nested-ternary */}+ {isAccessTokenRevoked+ ? "Revoked"+ : expiresAt+ ? format(expiresAt, "yyyy-MM-dd")+ : "—"}+ </TableCell>+ <TableCell>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton variant="ghost" size="xs" aria-label="Token actions">+ <EllipsisIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem+ onClick={() => {+ navigator.clipboard.writeText(id);+ createNotification({+ text: "Copied token ID to clipboard",+ type: "success"+ });+ }}+ >+ <CopyIcon />+ Copy Token ID+ </DropdownMenuItem>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Edit+ : OrgPermissionIdentityActions.Edit+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, {+ identityId+ })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ onClick={() => {+ handlePopUpOpen("token", {+ identityId,+ tokenId: id,+ name+ });+ }}+ >+ <PencilIcon />+ Edit Token+ </DropdownMenuItem>+ )}+ </VariablePermissionCan>+ {!isAccessTokenRevoked && (+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Edit+ : OrgPermissionIdentityActions.Edit+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, {+ identityId+ })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={() => {+ handlePopUpOpen("revokeToken", {+ identityId,+ tokenId: id,+ name+ });+ }}+ >+ <BanIcon />+ Revoke Token+ </DropdownMenuItem>+ )}+ </VariablePermissionCan>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ <Pagination+ count={tokens.length}+ page={page}+ perPage={perPage}+ perPageList={[5]}+ onChangePage={(newPage) => setPage(newPage)}+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}+ />+ </>+ ) : (+ <Empty className="border">+ <EmptyHeader>+ <EmptyTitle>No access tokens have been generated</EmptyTitle>+ <EmptyDescription>Create an access token to get started</EmptyDescription>+ </EmptyHeader>+ </Empty>+ )}+ <AlertDialog+ open={popUp.revokeToken.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("revokeToken", isOpen)}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <Trash2Icon />+ </AlertDialogMedia>+ <AlertDialogTitle>+ Revoke {revokeTokenData?.name ? `“${revokeTokenData.name}”` : "token"}?+ </AlertDialogTitle>+ <AlertDialogDescription>+ The token will no longer be usable. This action is irreversible.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={() => {+ if (revokeTokenData) onRevokeTokenSubmit(revokeTokenData);+ }}+ >+ Revoke+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ <IdentityTokenModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />+ </div>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/helpers/IdentityUniversalAuthClientSecretsTable.tsx b/frontend/src/views/IdentityAuthMethods/helpers/IdentityUniversalAuthClientSecretsTable.tsxnew file mode 100644index 0000000000..1016bd354f--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/IdentityUniversalAuthClientSecretsTable.tsx@@ -0,0 +1,258 @@+import { useState } from "react";+import { subject } from "@casl/ability";+import { useParams } from "@tanstack/react-router";+import { format } from "date-fns";+import { EllipsisIcon, PlusIcon, Trash2Icon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import { VariablePermissionCan } from "@app/components/permissions";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogMedia,+ AlertDialogTitle,+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyTitle,+ IconButton,+ Pagination,+ Table,+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow+} from "@app/components/v3";+import {+ OrgPermissionIdentityActions,+ OrgPermissionSubjects,+ ProjectPermissionIdentityActions,+ ProjectPermissionSub+} from "@app/context";+import { usePopUp } from "@app/hooks";+import { useRevokeIdentityUniversalAuthClientSecret } from "@app/hooks/api";+import { ClientSecretData } from "@app/hooks/api/identities/types";+import { IdentityClientSecretModal } from "@app/pages/organization/IdentityDetailsByIDPage/components";++type Props = {+ clientSecrets: ClientSecretData[];+ identityId: string;+};++export const IdentityUniversalAuthClientSecretsTable = ({ clientSecrets, identityId }: Props) => {+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([+ "revokeClientSecret",+ "clientSecret"+ ] as const);++ const { projectId } = useParams({+ strict: false+ });++ const [page, setPage] = useState(1);+ const [perPage, setPerPage] = useState(5);++ const { mutateAsync: revokeClientSecret } = useRevokeIdentityUniversalAuthClientSecret();++ const onDeleteClientSecretSubmit = async (clientSecretId: string) => {+ await revokeClientSecret({+ identityId,+ clientSecretId+ });++ handlePopUpToggle("revokeClientSecret", false);++ createNotification({+ text: "Successfully deleted client secret",+ type: "success"+ });+ };++ const revokeClientSecretData = popUp?.revokeClientSecret?.data as+ | { clientSecretId: string; clientSecretPrefix: string }+ | undefined;++ return (+ <div className="col-span-2 flex flex-col gap-2">+ <div className="flex items-end justify-between border-b border-border pb-2">+ <span className="text-foreground">Client Secrets</span>+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, {+ identityId+ })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <Button+ size="xs"+ variant="outline"+ isDisabled={!isAllowed}+ onClick={() => {+ handlePopUpOpen("clientSecret", {+ identityId+ });+ }}+ >+ <PlusIcon />+ Add Client Secret+ </Button>+ )}+ </VariablePermissionCan>+ </div>+ {clientSecrets.length > 0 ? (+ <>+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead>Secret</TableHead>+ <TableHead className="w-full" isTruncatable>+ Description+ </TableHead>+ <TableHead>Number of Uses</TableHead>+ <TableHead>Expires</TableHead>+ <TableHead className="w-5" />+ </TableRow>+ </TableHeader>+ <TableBody>+ {clientSecrets.slice((page - 1) * perPage, perPage * page).map((secret) => {+ const {+ createdAt,+ clientSecretTTL,+ description,+ clientSecretNumUses,+ clientSecretPrefix,+ clientSecretNumUsesLimit,+ id+ } = secret;++ let expiresAt: Date | undefined;+ if (clientSecretTTL > 0) {+ expiresAt = new Date(new Date(createdAt).getTime() + clientSecretTTL * 1000);+ }++ return (+ <TableRow key={id}>+ <TableCell>{clientSecretPrefix}***</TableCell>+ <TableCell isTruncatable>{description || "—"}</TableCell>+ <TableCell>+ {`${clientSecretNumUses}${clientSecretNumUsesLimit ? `/${clientSecretNumUsesLimit}` : ""}`}+ </TableCell>+ <TableCell>{expiresAt ? format(expiresAt, "yyyy-MM-dd") : "—"}</TableCell>+ <TableCell>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton variant="ghost" size="xs" aria-label="Client secret actions">+ <EllipsisIcon />+ </IconButton>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={+ projectId+ ? ProjectPermissionIdentityActions.Edit+ : OrgPermissionIdentityActions.Edit+ }+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, {+ identityId+ })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <DropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}+ onClick={() => {+ handlePopUpOpen("revokeClientSecret", {+ clientSecretPrefix,+ clientSecretId: id+ });+ }}+ >+ <Trash2Icon />+ Delete Secret+ </DropdownMenuItem>+ )}+ </VariablePermissionCan>+ </DropdownMenuContent>+ </DropdownMenu>+ </TableCell>+ </TableRow>+ );+ })}+ </TableBody>+ </Table>+ <Pagination+ count={clientSecrets.length}+ page={page}+ perPage={perPage}+ perPageList={[5]}+ onChangePage={(newPage) => setPage(newPage)}+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}+ />+ </>+ ) : (+ <Empty className="border">+ <EmptyHeader>+ <EmptyTitle>No client secrets have been generated</EmptyTitle>+ <EmptyDescription>Generate a client secret to get start</EmptyDescription>+ </EmptyHeader>+ </Empty>+ )}+ <AlertDialog+ open={popUp.revokeClientSecret.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("revokeClientSecret", isOpen)}+ >+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogMedia>+ <Trash2Icon />+ </AlertDialogMedia>+ <AlertDialogTitle>+ Delete client secret{" "}+ {revokeClientSecretData?.clientSecretPrefix+ ? `${revokeClientSecretData.clientSecretPrefix}************`+ : ""}+ ?+ </AlertDialogTitle>+ <AlertDialogDescription>+ The secret will no longer be usable. This action is irreversible.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ variant="danger"+ onClick={() => {+ if (revokeClientSecretData)+ onDeleteClientSecretSubmit(revokeClientSecretData.clientSecretId);+ }}+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ <IdentityClientSecretModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />+ </div>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/helpers/ResetLockoutsButton.tsx b/frontend/src/views/IdentityAuthMethods/helpers/ResetLockoutsButton.tsxnew file mode 100644index 0000000000..e2d90e1736--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/ResetLockoutsButton.tsx@@ -0,0 +1,71 @@+import { subject } from "@casl/ability";+import { useParams } from "@tanstack/react-router";++import { createNotification } from "@app/components/notifications";+import { VariablePermissionCan } from "@app/components/permissions";+import { Button } from "@app/components/v3";+import {+ OrgPermissionIdentityActions,+ OrgPermissionSubjects,+ ProjectPermissionIdentityActions,+ ProjectPermissionSub+} from "@app/context";+import {+ IdentityAuthMethod,+ useClearIdentityLdapAuthLockouts,+ useClearIdentityUniversalAuthLockouts+} from "@app/hooks/api";++type Props = {+ identityId: string;+ authMethod: IdentityAuthMethod;+ onSuccess: () => void;+};++export const ResetLockoutsButton = ({ identityId, authMethod, onSuccess }: Props) => {+ const universal = useClearIdentityUniversalAuthLockouts();+ const ldap = useClearIdentityLdapAuthLockouts();++ const { projectId } = useParams({ strict: false });++ let mutation: typeof universal | typeof ldap | null = null;+ if (authMethod === IdentityAuthMethod.UNIVERSAL_AUTH) mutation = universal;+ else if (authMethod === IdentityAuthMethod.LDAP_AUTH) mutation = ldap;++ if (!mutation) return null;++ const { mutateAsync, isPending } = mutation;++ const handleClear = async () => {+ const deleted = await mutateAsync({ identityId });+ createNotification({+ text: `Successfully cleared ${deleted} lockout${deleted === 1 ? "" : "s"}`,+ type: "success"+ });+ onSuccess();+ };++ return (+ <VariablePermissionCan+ type={projectId ? "project" : "org"}+ I={projectId ? ProjectPermissionIdentityActions.Edit : OrgPermissionIdentityActions.Edit}+ a={+ projectId+ ? subject(ProjectPermissionSub.Identity, { identityId })+ : OrgPermissionSubjects.Identity+ }+ >+ {(isAllowed) => (+ <Button+ variant="danger"+ size="xs"+ isDisabled={!isAllowed}+ onClick={handleClear}+ isPending={isPending}+ >+ Reset All Lockouts+ </Button>+ )}+ </VariablePermissionCan>+ );+};diff --git a/frontend/src/views/IdentityAuthMethods/helpers/index.ts b/frontend/src/views/IdentityAuthMethods/helpers/index.tsnew file mode 100644index 0000000000..78eb021224--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/helpers/index.ts@@ -0,0 +1,6 @@+export { IdentityAuthFieldDisplay } from "./IdentityAuthFieldDisplay";+export { IdentityAuthLockoutFields } from "./IdentityAuthLockoutFields";+export { IdentityAuthRevokeDialog } from "./IdentityAuthRevokeDialog";+export { IdentityTokenAuthTokensTable } from "./IdentityTokenAuthTokensTable";+export { IdentityUniversalAuthClientSecretsTable } from "./IdentityUniversalAuthClientSecretsTable";+export { ResetLockoutsButton } from "./ResetLockoutsButton";diff --git a/frontend/src/views/IdentityAuthMethods/index.ts b/frontend/src/views/IdentityAuthMethods/index.tsnew file mode 100644index 0000000000..fa4e046399--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/index.ts@@ -0,0 +1,3 @@+export { IdentityAuthMethodsCell } from "./IdentityAuthMethodsCell";+export { IdentityAuthMethodSheet } from "./IdentityAuthMethodSheet";+export { IdentityAuthMethodsTable } from "./IdentityAuthMethodsTable";diff --git a/frontend/src/views/IdentityAuthMethods/types.ts b/frontend/src/views/IdentityAuthMethods/types.tsnew file mode 100644index 0000000000..852781befa--- /dev/null+++ b/frontend/src/views/IdentityAuthMethods/types.ts@@ -0,0 +1,5 @@+export type ViewAuthMethodProps = {+ identityId: string;+ isLockedOut?: boolean;+ onMutated?: () => void;+};