From 62020ffc68c0c678892b4cb5890ce86425aa564d Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Thu, 18 Jan 2024 13:04:17 -0300 Subject: [PATCH] Make sure the component resolves to a UPConfig before cloning it Closes #26308 --- .../userprofile/DeclarativeUserProfileProvider.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/src/main/java/org/keycloak/userprofile/DeclarativeUserProfileProvider.java b/services/src/main/java/org/keycloak/userprofile/DeclarativeUserProfileProvider.java index a86e066e5b..5792f5eb34 100644 --- a/services/src/main/java/org/keycloak/userprofile/DeclarativeUserProfileProvider.java +++ b/services/src/main/java/org/keycloak/userprofile/DeclarativeUserProfileProvider.java @@ -201,8 +201,13 @@ public class DeclarativeUserProfileProvider implements UserProfileProvider { Optional component = getComponentModel(); if (component.isPresent()) { - UPConfig cfg = getConfigFromComponentModel(component.get()).clone(); - return cfg == null ? parsedDefaultRawConfig.clone() : cfg; + UPConfig cfg = getConfigFromComponentModel(component.get()); + + if (cfg == null) { + cfg = parsedDefaultRawConfig; + } + + return cfg.clone(); } return parsedDefaultRawConfig.clone();