/* eslint-disable */ // @ts-nocheck import { ActionGroup, Button, FormGroup, Switch } from "../../../shared/@patternfly/react-core"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { FormAccess } from "../../components/form/FormAccess"; import { HelpItem, SelectControl } from "../../../shared/keycloak-ui-shared"; import { convertAttributeNameToForm } from "../../util"; import { FormFields } from "../ClientDetails"; import useIsFeatureEnabled, { Feature } from "../../utils/useIsFeatureEnabled"; import { MapComponent } from "../../components/dynamic/MapComponent"; type OpenIdConnectCompatibilityModesProps = { save: () => void; reset: () => void; hasConfigureAccess?: boolean; }; export const OpenIdConnectCompatibilityModes = ({ save, reset, hasConfigureAccess, }: OpenIdConnectCompatibilityModesProps) => { const { t } = useTranslation(); const { control, watch } = useFormContext(); const isFeatureEnabled = useIsFeatureEnabled(); const tokenExchangeEnabled = watch( convertAttributeNameToForm( "attributes.standard.token.exchange.enabled", ), ); const useRefreshTokens = watch( convertAttributeNameToForm("attributes.use.refresh.tokens"), "true", ); const jwtAuthorizationGrantEnabled = watch( convertAttributeNameToForm( "attributes.oauth2.jwt.authorization.grant.enabled", ), false, ); const jwtAuthorizationGrantIdP = watch( convertAttributeNameToForm( "attributes.oauth2.jwt.authorization.grant.idp", ), ); return ( } > ( "attributes.exclude.session.state.from.auth.response", )} defaultValue="" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("excludeSessionStateFromAuthenticationResponse")} /> )} /> } > ( "attributes.exclude.issuer.from.auth.response", )} defaultValue="" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("excludeIssuerFromAuthenticationResponse")} /> )} /> } > ( "attributes.use.refresh.tokens", )} defaultValue="true" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("useRefreshTokens")} /> )} /> } > ( "attributes.client_credentials.use_refresh_token", )} defaultValue="false" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("useRefreshTokenForClientCredentialsGrant")} /> )} /> } > ( "attributes.token.response.type.bearer.lower-case", )} defaultValue="false" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("useLowerCaseBearerType")} /> )} /> } > ( "attributes.allow.token.introspection.without.audience.check", )} defaultValue="" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("allowTokenIntrospectionWithoutAudienceCheck")} /> )} /> } > ( "attributes.allow.userinfo.with.lightweight.access.token", )} defaultValue="" control={control} render={({ field }) => ( field.onChange(value.toString())} aria-label={t("allowUserinfoWithLightweightAccessToken")} /> )} /> {isFeatureEnabled(Feature.StandardTokenExchangeV2) && ( ( "attributes.standard.token.exchange.enableRefreshRequestedTokenType", )} label={t("enableRefreshRequestedTokenType")} labelIcon={t("enableRefreshRequestedTokenTypeHelp")} controller={{ defaultValue: "", }} isDisabled={ tokenExchangeEnabled?.toString() !== "true" || useRefreshTokens?.toString() !== "true" } options={[ { key: "", value: t("choose") }, { key: "NO", value: t("no") }, { key: "SAME_SESSION", value: t("sameSession") }, ]} /> )} {isFeatureEnabled(Feature.JWTAuthorizationGrant) && jwtAuthorizationGrantEnabled.toString() === "true" && jwtAuthorizationGrantIdP && ( )} ); };