From c36b220745db355f47cc3d1f4a964efa81925125 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 23 Mar 2023 16:27:51 +0100 Subject: [PATCH] Use signature providers instead of hardcoded index (#19198) --- .../admin-ui/src/realm-settings/TokensTab.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/js/apps/admin-ui/src/realm-settings/TokensTab.tsx b/js/apps/admin-ui/src/realm-settings/TokensTab.tsx index 553a336e37..905d6bf63a 100644 --- a/js/apps/admin-ui/src/realm-settings/TokensTab.tsx +++ b/js/apps/admin-ui/src/realm-settings/TokensTab.tsx @@ -26,7 +26,7 @@ import { } from "../components/time-selector/TimeSelector"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { useWhoAmI } from "../context/whoami/WhoAmI"; -import { convertToFormValues } from "../util"; +import { convertToFormValues, sortProviders } from "../util"; import "./realm-settings-section.css"; @@ -48,18 +48,8 @@ export const RealmSettingsTokensTab = ({ const [defaultSigAlgDrpdwnIsOpen, setDefaultSigAlgDrpdwnOpen] = useState(false); - const allComponentTypes = - serverInfo.componentTypes?.["org.keycloak.keys.KeyProvider"] ?? []; - - const esOptions = ["ES256", "ES384", "ES512"]; - - const hmacAlgorithmOptions = allComponentTypes[2].properties[4].options; - - const javaKeystoreAlgOptions = allComponentTypes[3].properties[3].options; - - const defaultSigAlgOptions = esOptions.concat( - hmacAlgorithmOptions!, - javaKeystoreAlgOptions! + const defaultSigAlgOptions = sortProviders( + serverInfo.providers!["signature"].providers ); const form = useForm();