From 7629b7dc536ba94de982773aa1d5d5a162fb956b Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Fri, 15 Aug 2025 07:28:45 +0200 Subject: [PATCH] Show required fields when configuring protocol mappers Closes #40619 Signed-off-by: Alexander Schwartz --- .../upgrading/topics/changes/changes-26_4_0.adoc | 8 ++++++++ .../admin-ui/src/components/dynamic/StringComponent.tsx | 6 ++++++ .../protocol/oidc/mappers/OIDCAttributeMapperHelper.java | 1 + .../protocol/oidc/mappers/UserSessionNoteMapper.java | 1 + 4 files changed, 16 insertions(+) diff --git a/docs/documentation/upgrading/topics/changes/changes-26_4_0.adoc b/docs/documentation/upgrading/topics/changes/changes-26_4_0.adoc index c1915bddf01..1ce52086c9a 100644 --- a/docs/documentation/upgrading/topics/changes/changes-26_4_0.adoc +++ b/docs/documentation/upgrading/topics/changes/changes-26_4_0.adoc @@ -55,6 +55,14 @@ When using the `+/realms/{realm-name}/broker/{provider_alias}/token+` endpoint f When using GitHub as an IDP, you can now enable JSON responses to leverage the token refresh for this endpoint. +== Required field in User Session note mapper + +The name of the session note is now shown as a required field in the Admin UI. + +== Required field in OIDC attribute mapper + +The name of the token claim is now shown as a required field in the Admin UI. + === Volatile user sessions affecting offline session memory requirements Starting with this release, {project_name} will cache by default only 10000 entries for offline user and client sessions in memory when volatile user sessions are enabled. This will greatly reduce memory usage. diff --git a/js/apps/admin-ui/src/components/dynamic/StringComponent.tsx b/js/apps/admin-ui/src/components/dynamic/StringComponent.tsx index 74e4bdb5bd7..77ffc369eb7 100644 --- a/js/apps/admin-ui/src/components/dynamic/StringComponent.tsx +++ b/js/apps/admin-ui/src/components/dynamic/StringComponent.tsx @@ -17,6 +17,12 @@ export const StringComponent = ({ label={t(label!)} labelIcon={t(helpText!)} data-testid={name} + rules={{ + required: { + value: !!props.required, + message: t("required"), + }, + }} {...props} /> ); diff --git a/services/src/main/java/org/keycloak/protocol/oidc/mappers/OIDCAttributeMapperHelper.java b/services/src/main/java/org/keycloak/protocol/oidc/mappers/OIDCAttributeMapperHelper.java index ef00070732a..379d9b8e038 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/mappers/OIDCAttributeMapperHelper.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/mappers/OIDCAttributeMapperHelper.java @@ -438,6 +438,7 @@ public class OIDCAttributeMapperHelper { property.setLabel(TOKEN_CLAIM_NAME_LABEL); property.setType(ProviderConfigProperty.STRING_TYPE); property.setHelpText(TOKEN_CLAIM_NAME_TOOLTIP); + property.setRequired(true); configProperties.add(property); } diff --git a/services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java b/services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java index cdc4a0f9af3..6833b83d53f 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/mappers/UserSessionNoteMapper.java @@ -49,6 +49,7 @@ public class UserSessionNoteMapper extends AbstractOIDCProtocolMapper implements property.setLabel(ProtocolMapperUtils.USER_SESSION_MODEL_NOTE_LABEL); property.setHelpText(ProtocolMapperUtils.USER_SESSION_MODEL_NOTE_HELP_TEXT); property.setType(ProviderConfigProperty.STRING_TYPE); + property.setRequired(true); configProperties.add(property); OIDCAttributeMapperHelper.addAttributeConfig(configProperties, UserSessionNoteMapper.class); }