/* eslint-disable */ // @ts-nocheck import { HelpItem, TextControl, SelectControl, } from "../../../shared/keycloak-ui-shared"; import { ActionGroup, Button, FormGroup, TextInput, } from "../../../shared/@patternfly/react-core"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { DefaultSwitchControl } from "../../components/SwitchControl"; import { FormAccess } from "../../components/form/FormAccess"; import { KeyValueInput } from "../../components/key-value-form/KeyValueInput"; import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; import { TimeSelector } from "../../components/time-selector/TimeSelector"; import { useRealm } from "../../context/realm-context/RealmContext"; import { convertAttributeNameToForm } from "../../util"; import { FormFields } from "../ClientDetails"; import { TokenLifespan } from "./TokenLifespan"; import useIsFeatureEnabled, { Feature } from "../../utils/useIsFeatureEnabled"; type AdvancedSettingsProps = { save: () => void; reset: () => void; protocol?: string; hasConfigureAccess?: boolean; }; export const AdvancedSettings = ({ save, reset, protocol, hasConfigureAccess, }: AdvancedSettingsProps) => { const { t } = useTranslation(); const { realmRepresentation: realm } = useRealm(); const { control, watch, register } = useFormContext(); const acrUriMapRealm = realm.attributes?.["acr.uri.map"] ? Object.values(JSON.parse(realm.attributes["acr.uri.map"])) : []; const acrLoAMapClient = watch( convertAttributeNameToForm("attributes.acr.loa.map"), [], ); const validAcrLoAOptions = () => acrLoAMapClient.length > 0 ? acrLoAMapClient.map((i: any) => i?.key).filter((i: any) => i !== "") : acrUriMapRealm; const acrLoAMapNamesOptions = () => [ { key: "", value: t("choose") }, ...validAcrLoAOptions().map((i: any) => ({ key: i, value: i })), ]; const isFeatureEnabled = useIsFeatureEnabled(); return ( {protocol === "saml" && ( <> } > ( "attributes.saml.assertion.lifespan", )} defaultValue="" control={control} render={({ field }) => ( )} /> {isFeatureEnabled(Feature.StepUpAuthenticationSaml) && ( <> } > ( Number.isInteger(parseInt(v)), })} /> )} /> v === "" || validAcrLoAOptions().includes(v), }, }} options={acrLoAMapNamesOptions()} /> )} )} {protocol === "openid-connect" && ( <> {realm.offlineSessionMaxLifespanEnabled && ( )} ( "attributes.tls.client.certificate.bound.access.tokens", )} label={t("oAuthMutual")} labelIcon={t("oAuthMutualHelp")} stringify /> ( "attributes.require.pushed.authorization.requests", )} label={t("pushedAuthorizationRequestRequired")} labelIcon={t("pushedAuthorizationRequestRequiredHelp")} stringify /> ( "attributes.client.use.lightweight.access.token.enabled", )} label={t("lightweightAccessToken")} labelIcon={t("lightweightAccessTokenHelp")} stringify /> ( "attributes.client.introspection.response.allow.jwt.claim.enabled", )} label={t("supportJwtClaimInIntrospectionResponse")} labelIcon={t("supportJwtClaimInIntrospectionResponseHelp")} stringify /> } > ( Number.isInteger(parseInt(v)), })} /> )} /> } > )} ); };