Added missing default field (#2693)

This commit is contained in:
Erik Jan de Wit 2022-05-27 11:26:49 +02:00 committed by GitHub
parent e92ed5b98c
commit ffae9b3072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 2 deletions

View file

@ -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.", "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.", "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.", "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.", "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.", "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", "logoutServicePostBindingURL": "SAML POST Binding URL for the client's single logout service. You can leave this blank if you are using a different binding",

View file

@ -477,6 +477,7 @@
"keyForCodeExchange": "Proof Key for Code Exchange Code Challenge Method", "keyForCodeExchange": "Proof Key for Code Exchange Code Challenge Method",
"pushedAuthorizationRequestRequired": "Pushed authorization request required", "pushedAuthorizationRequestRequired": "Pushed authorization request required",
"acrToLoAMapping": "ACR to LoA Mapping", "acrToLoAMapping": "ACR to LoA Mapping",
"defaultACRValues": "Default ACR Values",
"authenticationOverrides": "Authentication flow overrides", "authenticationOverrides": "Authentication flow overrides",
"browserFlow": "Browser Flow", "browserFlow": "Browser Flow",
"directGrant": "Direct Grant Flow", "directGrant": "Direct Grant Flow",

View file

@ -71,7 +71,7 @@ import { toClientScopesTab } from "./routes/ClientScopeTab";
import { AuthorizationExport } from "./authorization/AuthorizationExport"; import { AuthorizationExport } from "./authorization/AuthorizationExport";
import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../context/server-info/ServerInfoProvider";
import { PermissionsTab } from "../components/permission-tab/PermissionTab"; 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"; import { useAccess } from "../context/access/Access";
type ClientDetailHeaderProps = { 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 || {}) Object.entries(client.attributes || {})
.filter(([key]) => key.startsWith("saml.server.signature")) .filter(([key]) => key.startsWith("saml.server.signature"))
.map(([key, value]) => .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 = const submittedClient =
convertFormValuesToObject<ClientRepresentation>(values); convertFormValuesToObject<ClientRepresentation>(values);
@ -304,7 +316,11 @@ export default function ClientDetails() {
if (submittedClient.attributes?.["acr.loa.map"]) { if (submittedClient.attributes?.["acr.loa.map"]) {
submittedClient.attributes["acr.loa.map"] = JSON.stringify( 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])
)
); );
} }

View file

@ -16,6 +16,7 @@ import { HelpItem } from "../../components/help-enabler/HelpItem";
import { TimeSelector } from "../../components/time-selector/TimeSelector"; import { TimeSelector } from "../../components/time-selector/TimeSelector";
import { TokenLifespan } from "./TokenLifespan"; import { TokenLifespan } from "./TokenLifespan";
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput"; import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
import { MultiLineInput } from "../../components/multi-line-input/MultiLineInput";
type AdvancedSettingsProps = { type AdvancedSettingsProps = {
control: Control<Record<string, any>>; control: Control<Record<string, any>>;
@ -168,6 +169,18 @@ export const AdvancedSettings = ({
> >
<KeyValueInput name="attributes.acr.loa.map" /> <KeyValueInput name="attributes.acr.loa.map" />
</FormGroup> </FormGroup>
<FormGroup
label={t("defaultACRValues")}
fieldId="defaultACRValues"
labelIcon={
<HelpItem
helpText="clients-help:defaultACRValues"
fieldLabelId="clients:defaultACRValues"
/>
}
>
<MultiLineInput name="attributes.default.acr.values" />
</FormGroup>
</> </>
)} )}
<ActionGroup> <ActionGroup>