From ffae9b307261825b8b4b6f5baa40f8b95ff36eca Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 27 May 2022 11:26:49 +0200 Subject: [PATCH] Added missing default field (#2693) --- public/resources/en/clients-help.json | 1 + public/resources/en/clients.json | 1 + src/clients/ClientDetails.tsx | 20 ++++++++++++++++++-- src/clients/advanced/AdvancedSettings.tsx | 13 +++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/public/resources/en/clients-help.json b/public/resources/en/clients-help.json index 7f13247eb9..09ea1f840a 100644 --- a/public/resources/en/clients-help.json +++ b/public/resources/en/clients-help.json @@ -99,6 +99,7 @@ "keyForCodeExchange": "Choose which code challenge method for PKCE is used. If not specified, keycloak does not applies PKCE to a client unless the client sends an authorization request with appropriate code challenge and code exchange method.", "pushedAuthorizationRequestRequired": "Boolean parameter indicating whether the authorization server accepts authorization request data only via the pushed authorization request method.", "acrToLoAMapping": "Define which ACR (Authentication Context Class Reference) value is mapped to which LoA (Level of Authentication). The ACR can be any value, whereas the LoA must be numeric.", + "defaultACRValues": "Default values to be used as voluntary ACR in case that there is no explicit ACR requested by 'claims' or 'acr_values' parameter in the OIDC request.", "assertionConsumerServicePostBindingURL": "SAML POST Binding URL for the client's assertion consumer service (login responses). You can leave this blank if you do not have a URL for this binding.", "assertionConsumerServiceRedirectBindingURL": "SAML Redirect Binding URL for the client's assertion consumer service (login responses). You can leave this blank if you do not have a URL for this binding.", "logoutServicePostBindingURL": "SAML POST Binding URL for the client's single logout service. You can leave this blank if you are using a different binding", diff --git a/public/resources/en/clients.json b/public/resources/en/clients.json index 2e45f8d451..db89e6ddb4 100644 --- a/public/resources/en/clients.json +++ b/public/resources/en/clients.json @@ -477,6 +477,7 @@ "keyForCodeExchange": "Proof Key for Code Exchange Code Challenge Method", "pushedAuthorizationRequestRequired": "Pushed authorization request required", "acrToLoAMapping": "ACR to LoA Mapping", + "defaultACRValues": "Default ACR Values", "authenticationOverrides": "Authentication flow overrides", "browserFlow": "Browser Flow", "directGrant": "Direct Grant Flow", diff --git a/src/clients/ClientDetails.tsx b/src/clients/ClientDetails.tsx index 5434e9a814..b8984ad6ae 100644 --- a/src/clients/ClientDetails.tsx +++ b/src/clients/ClientDetails.tsx @@ -71,7 +71,7 @@ import { toClientScopesTab } from "./routes/ClientScopeTab"; import { AuthorizationExport } from "./authorization/AuthorizationExport"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { PermissionsTab } from "../components/permission-tab/PermissionTab"; -import { keyValueToArray } from "../components/key-value-form/key-value-convert"; +import type { KeyValueType } from "../components/key-value-form/key-value-convert"; import { useAccess } from "../context/access/Access"; type ClientDetailHeaderProps = { @@ -249,6 +249,12 @@ export default function ClientDetails() { ) ); } + if (client.attributes?.["default.acr.values"]) { + form.setValue( + "attributes.default.acr.values", + stringToMultiline(client.attributes["default.acr.values"]) + ); + } Object.entries(client.attributes || {}) .filter(([key]) => key.startsWith("saml.server.signature")) .map(([key, value]) => @@ -292,6 +298,12 @@ export default function ClientDetails() { ); } + if (values.attributes?.default?.acr?.values) { + values.attributes["default.acr.values"] = toStringValue( + values.attributes.default.acr.values + ); + } + const submittedClient = convertFormValuesToObject(values); @@ -304,7 +316,11 @@ export default function ClientDetails() { if (submittedClient.attributes?.["acr.loa.map"]) { submittedClient.attributes["acr.loa.map"] = JSON.stringify( - keyValueToArray(submittedClient.attributes["acr.loa.map"]) + Object.fromEntries( + (submittedClient.attributes["acr.loa.map"] as KeyValueType[]) + .filter(({ key }) => key !== "") + .map(({ key, value }) => [key, value]) + ) ); } diff --git a/src/clients/advanced/AdvancedSettings.tsx b/src/clients/advanced/AdvancedSettings.tsx index fa17358479..56a86449a4 100644 --- a/src/clients/advanced/AdvancedSettings.tsx +++ b/src/clients/advanced/AdvancedSettings.tsx @@ -16,6 +16,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem"; import { TimeSelector } from "../../components/time-selector/TimeSelector"; import { TokenLifespan } from "./TokenLifespan"; import { KeyValueInput } from "../../components/key-value-form/KeyValueInput"; +import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput"; type AdvancedSettingsProps = { control: Control>; @@ -168,6 +169,18 @@ export const AdvancedSettings = ({ > + + } + > + + )}