From f73aaef67a6d2fe2e3ca5b93b21fd45b22c914c0 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Fri, 3 Feb 2017 10:05:57 +0100 Subject: [PATCH] KEYCLOAK-4370 Prevent LDAP provider from being migrated twice --- .../updater/liquibase/custom/MigrateUserFedToComponent.java | 4 +++- .../liquibase/custom/PortLdapUserFedToComponentModel.java | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java index bf3e92d33f..94cb5b1295 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/MigrateUserFedToComponent.java @@ -40,7 +40,9 @@ public class MigrateUserFedToComponent extends AbstractUserFedToComponent { protected void generateStatementsImpl() throws CustomChangeException { List factories = kcSession.getKeycloakSessionFactory().getProviderFactories(UserStorageProvider.class); for (ProviderFactory factory : factories) { - convertFedProviderToComponent(factory.getId(), null); + if (!factory.getId().equals(LDAPConstants.LDAP_PROVIDER)) { + convertFedProviderToComponent(factory.getId(), null); + } } } diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java index dc9e6073c3..8d1e6795f4 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/PortLdapUserFedToComponentModel.java @@ -27,7 +27,6 @@ public class PortLdapUserFedToComponentModel extends AbstractUserFedToComponent @Override protected void generateStatementsImpl() throws CustomChangeException { - String providerId = LDAPConstants.LDAP_PROVIDER; convertFedProviderToComponent(LDAPConstants.LDAP_PROVIDER, "org.keycloak.storage.ldap.mappers.LDAPStorageMapper"); }