diff --git a/src/realm-settings/GeneralTab.tsx b/src/realm-settings/GeneralTab.tsx index 2c8b0b7616..0cf08c4d82 100644 --- a/src/realm-settings/GeneralTab.tsx +++ b/src/realm-settings/GeneralTab.tsx @@ -24,6 +24,7 @@ import { FormAccess } from "../components/form-access/FormAccess"; import { HelpItem } from "../components/help-enabler/HelpItem"; import { FormattedLink } from "../components/external-link/FormattedLink"; import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput"; +import { KeyValueInput } from "../components/key-value-form/KeyValueInput"; type RealmSettingsGeneralTabProps = { save: (realm: RealmRepresentation) => void; @@ -143,6 +144,18 @@ export const RealmSettingsGeneralTab = ({ )} /> + + } + > + + void; @@ -187,6 +188,15 @@ export const RealmSettingsTabs = ({ const setupForm = (r: RealmRepresentation = realm) => { convertToFormValues(r, setValue); + if (r.attributes?.["acr.loa.map"]) { + form.setValue( + "attributes.acr.loa.map", + Object.entries(JSON.parse(r.attributes["acr.loa.map"])).flatMap( + ([key, value]) => ({ key, value }) + ) + ); + } + if (r.supportedLocales?.length === 0) { setValue("supportedLocales", [DEFAULT_LOCALE]); } @@ -200,6 +210,15 @@ export const RealmSettingsTabs = ({ const save = async (realm: RealmRepresentation) => { try { realm = convertFormValuesToObject(realm); + if (realm.attributes?.["acr.loa.map"]) { + realm.attributes["acr.loa.map"] = JSON.stringify( + Object.fromEntries( + (realm.attributes["acr.loa.map"] as KeyValueType[]) + .filter(({ key }) => key !== "") + .map(({ key, value }) => [key, value]) + ) + ); + } await adminClient.realms.update( { realm: realmName },