diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/AbstractConfigPropertySynchronizer.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/AbstractConfigPropertySynchronizer.java
deleted file mode 100644
index df79cc9b97..0000000000
--- a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/AbstractConfigPropertySynchronizer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2022 Red Hat, Inc. and/or its affiliates
- * and other contributors as indicated by the @author tags.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.keycloak.broker.provider.mappersync;
-
-import org.jboss.logging.Logger;
-import org.keycloak.models.IdentityProviderMapperModel;
-import org.keycloak.models.RealmModel;
-import org.keycloak.provider.ProviderEvent;
-import org.keycloak.utils.StringUtil;
-
-import java.util.Map;
-import java.util.function.Consumer;
-
-/**
- * Abstract base class for updating a single reference (specified via a single config property).
- *
- * @author Daniel Fesenmeyer
- */
-public abstract class AbstractConfigPropertySynchronizer implements ConfigSynchronizer {
-
- private static final Logger LOG = Logger.getLogger(AbstractConfigPropertySynchronizer.class);
-
- protected void logEventProcessed(String configPropertyName, String previousValue, String newValue, String realmName,
- String mapperName, String idpAlias) {
- LOG.infof(
- "Reference of type '%s' changed from '%s' to '%s' in realm '%s'. Adjusting the reference from mapper '%s' of IDP '%s'.",
- configPropertyName, previousValue, newValue, realmName, mapperName, idpAlias);
-
- }
-}
diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/ConfigSynchronizer.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/ConfigSynchronizer.java
index 7f13b9afc5..5d1136ac12 100644
--- a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/ConfigSynchronizer.java
+++ b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/ConfigSynchronizer.java
@@ -17,6 +17,7 @@
package org.keycloak.broker.provider.mappersync;
+import org.jboss.logging.Logger;
import org.keycloak.models.IdentityProviderMapperModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
@@ -28,7 +29,17 @@ import org.keycloak.provider.ProviderEvent;
* @author Daniel Fesenmeyer
*/
public interface ConfigSynchronizer {
+ Logger LOG = Logger.getLogger(ConfigSynchronizer.class);
+
Class getEventClass();
void handleEvent(T event);
+
+ default void logEventProcessed(String configPropertyName, String previousValue, String newValue, String realmName,
+ String mapperName, String idpAlias) {
+ LOG.infof(
+ "Reference of type '%s' changed from '%s' to '%s' in realm '%s'. Adjusting the reference from mapper '%s' of IDP '%s'.",
+ configPropertyName, previousValue, newValue, realmName, mapperName, idpAlias);
+
+ }
}
diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/GroupConfigPropertyByPathSynchronizer.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/GroupConfigPropertyByPathSynchronizer.java
index c81f45a5e0..ddbf8008db 100644
--- a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/GroupConfigPropertyByPathSynchronizer.java
+++ b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/GroupConfigPropertyByPathSynchronizer.java
@@ -33,7 +33,7 @@ import static org.keycloak.models.utils.KeycloakModelUtils.GROUP_PATH_SEPARATOR;
*
* @author Daniel Fesenmeyer
*/
-public class GroupConfigPropertyByPathSynchronizer extends AbstractConfigPropertySynchronizer {
+public class GroupConfigPropertyByPathSynchronizer implements ConfigSynchronizer {
public static final GroupConfigPropertyByPathSynchronizer INSTANCE = new GroupConfigPropertyByPathSynchronizer();
@@ -53,7 +53,7 @@ public class GroupConfigPropertyByPathSynchronizer extends AbstractConfigPropert
event.getKeycloakSession().identityProviders().getMappersStream(Map.of(ConfigConstants.GROUP, event.getPreviousPath()), null, null)
.forEach(idpMapper -> {
idpMapper.getConfig().put(ConfigConstants.GROUP, event.getNewPath());
- super.logEventProcessed(ConfigConstants.GROUP, event.getPreviousPath(), event.getNewPath(), event.getRealm().getName(),
+ logEventProcessed(ConfigConstants.GROUP, event.getPreviousPath(), event.getNewPath(), event.getRealm().getName(),
idpMapper.getName(), idpMapper.getIdentityProviderAlias());
event.getKeycloakSession().identityProviders().updateMapper(idpMapper);
});
@@ -65,7 +65,7 @@ public class GroupConfigPropertyByPathSynchronizer extends AbstractConfigPropert
String currentGroupPath = idpMapper.getConfig().get(ConfigConstants.GROUP);
String newGroupPath = event.getNewPath() + currentGroupPath.substring(event.getPreviousPath().length());
idpMapper.getConfig().put(ConfigConstants.GROUP, newGroupPath);
- super.logEventProcessed(ConfigConstants.GROUP, currentGroupPath, newGroupPath, event.getRealm().getName(),
+ logEventProcessed(ConfigConstants.GROUP, currentGroupPath, newGroupPath, event.getRealm().getName(),
idpMapper.getName(), idpMapper.getIdentityProviderAlias());
event.getKeycloakSession().identityProviders().updateMapper(idpMapper);
});
diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByClientIdSynchronizer.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByClientIdSynchronizer.java
index 6a622b3245..e1ba9850cd 100644
--- a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByClientIdSynchronizer.java
+++ b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByClientIdSynchronizer.java
@@ -31,7 +31,7 @@ import java.util.function.Consumer;
*
* @author Daniel Fesenmeyer
*/
-public class RoleConfigPropertyByClientIdSynchronizer extends AbstractConfigPropertySynchronizer {
+public class RoleConfigPropertyByClientIdSynchronizer implements ConfigSynchronizer {
public static final RoleConfigPropertyByClientIdSynchronizer INSTANCE =
new RoleConfigPropertyByClientIdSynchronizer();
@@ -54,7 +54,7 @@ public class RoleConfigPropertyByClientIdSynchronizer extends AbstractConfigProp
String configuredRoleName = KeycloakModelUtils.parseRole(currentRoleValue)[1];
String newRoleValue = KeycloakModelUtils.buildRoleQualifier(event.getNewClientId(), configuredRoleName);
idpMapper.getConfig().put(ConfigConstants.ROLE, newRoleValue);
- super.logEventProcessed(ConfigConstants.ROLE, currentRoleValue, newRoleValue, event.getUpdatedClient().getRealm().getName(),
+ logEventProcessed(ConfigConstants.ROLE, currentRoleValue, newRoleValue, event.getUpdatedClient().getRealm().getName(),
idpMapper.getName(), idpMapper.getIdentityProviderAlias());
event.getKeycloakSession().identityProviders().updateMapper(idpMapper);
});
diff --git a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByRoleNameSynchronizer.java b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByRoleNameSynchronizer.java
index 67ce7325d3..25e648c06d 100644
--- a/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByRoleNameSynchronizer.java
+++ b/server-spi-private/src/main/java/org/keycloak/broker/provider/mappersync/RoleConfigPropertyByRoleNameSynchronizer.java
@@ -31,8 +31,7 @@ import java.util.function.Consumer;
*
* @author Daniel Fesenmeyer
*/
-public class RoleConfigPropertyByRoleNameSynchronizer
- extends AbstractConfigPropertySynchronizer {
+public class RoleConfigPropertyByRoleNameSynchronizer implements ConfigSynchronizer {
public static final RoleConfigPropertyByRoleNameSynchronizer INSTANCE =
new RoleConfigPropertyByRoleNameSynchronizer();
@@ -54,7 +53,7 @@ public class RoleConfigPropertyByRoleNameSynchronizer
.forEach(idpMapper -> {
String newRoleValue = KeycloakModelUtils.buildRoleQualifier(event.getClientId(), event.getNewName());
idpMapper.getConfig().put(ConfigConstants.ROLE, newRoleValue);
- super.logEventProcessed(ConfigConstants.ROLE, currentRoleValue, newRoleValue, event.getRealm().getName(),
+ logEventProcessed(ConfigConstants.ROLE, currentRoleValue, newRoleValue, event.getRealm().getName(),
idpMapper.getName(), idpMapper.getIdentityProviderAlias());
event.getKeycloakSession().identityProviders().updateMapper(idpMapper);
});