Keep correct format of config fields

Fixes: #29314

Signed-off-by: Hynek Mlnarik <hmlnarik@redhat.com>
This commit is contained in:
Hynek Mlnarik 2024-05-15 14:32:54 +02:00 committed by Hynek Mlnařík
parent 3ecc564575
commit ef4a246aa9

View file

@ -328,10 +328,12 @@ export default function DetailSettings() {
const save = async (savedProvider?: IdentityProviderRepresentation) => { const save = async (savedProvider?: IdentityProviderRepresentation) => {
const p = savedProvider || getValues(); const p = savedProvider || getValues();
const origAuthnContextClassRefs = p.config?.authnContextClassRefs;
if (p.config?.authnContextClassRefs) if (p.config?.authnContextClassRefs)
p.config.authnContextClassRefs = JSON.stringify( p.config.authnContextClassRefs = JSON.stringify(
p.config.authnContextClassRefs, p.config.authnContextClassRefs,
); );
const origAuthnContextDeclRefs = p.config?.authnContextDeclRefs;
if (p.config?.authnContextDeclRefs) if (p.config?.authnContextDeclRefs)
p.config.authnContextDeclRefs = JSON.stringify( p.config.authnContextDeclRefs = JSON.stringify(
p.config.authnContextDeclRefs, p.config.authnContextDeclRefs,
@ -347,6 +349,12 @@ export default function DetailSettings() {
providerId, providerId,
}, },
); );
if (origAuthnContextClassRefs) {
p.config!.authnContextClassRefs = origAuthnContextClassRefs;
}
if (origAuthnContextDeclRefs) {
p.config!.authnContextDeclRefs = origAuthnContextDeclRefs;
}
reset(p); reset(p);
addAlert(t("updateSuccessIdentityProvider"), AlertVariant.success); addAlert(t("updateSuccessIdentityProvider"), AlertVariant.success);
} catch (error) { } catch (error) {