From 01ab5b12e0a972c6fa6e44d72986ead95ef25e43 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Mon, 7 Mar 2022 18:08:14 +0100 Subject: [PATCH] Added and removed saml fields (#2168) --- src/clients/ClientSettings.tsx | 149 ++++++++++++++++++++++++--------- src/clients/help.ts | 6 ++ src/clients/messages.ts | 4 + 3 files changed, 120 insertions(+), 39 deletions(-) diff --git a/src/clients/ClientSettings.tsx b/src/clients/ClientSettings.tsx index 527fa49d71..60870e30dd 100644 --- a/src/clients/ClientSettings.tsx +++ b/src/clients/ClientSettings.tsx @@ -25,6 +25,8 @@ import { SaveReset } from "./advanced/SaveReset"; import { SamlConfig } from "./add/SamlConfig"; import { SamlSignature } from "./add/SamlSignature"; import type { ClientForm } from "./ClientDetails"; +import environment from "../environment"; +import { useRealm } from "../context/realm-context/RealmContext"; type ClientSettingsProps = { client: ClientRepresentation; @@ -39,6 +41,7 @@ export const ClientSettings = ({ }: ClientSettingsProps) => { const { register, control, watch, errors } = useFormContext(); const { t } = useTranslation("clients"); + const { realm } = useRealm(); const [loginThemeOpen, setLoginThemeOpen] = useState(false); const loginThemes = useServerInfo().themes!["login"]; @@ -48,6 +51,9 @@ export const ClientSettings = ({ ); const protocol = watch("protocol"); const frontchannelLogout = watch("frontchannelLogout"); + const idpInitiatedSsoUrlName: string = watch( + "attributes.saml_idp_initiated_sso_url_name" + ); const sections = useMemo(() => { let result = ["generalSettings"]; @@ -97,22 +103,6 @@ export const ClientSettings = ({ ref={register} /> - - } - > - - } > + {protocol === "saml" && ( + <> + + } + helperText={ + idpInitiatedSsoUrlName !== "" && + t("idpInitiatedSsoUrlNameHelp", { + url: `${environment.authServerUrl}/realms/${realm}/protocol/saml/clients/${idpInitiatedSsoUrlName}`, + }) + } + > + + + + } + > + + + + } + > + + + + )} + {protocol !== "saml" && ( + + } + > + + + )} )} - + } + > + - } - > - - + + )} {client.bearerOnly && (