diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/AbstractUserFedToComponent.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/AbstractUserFedToComponent.java index e86788b75f..7e6819cb6d 100644 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/AbstractUserFedToComponent.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/updater/liquibase/custom/AbstractUserFedToComponent.java @@ -21,7 +21,6 @@ import liquibase.statement.core.DeleteStatement; import liquibase.statement.core.InsertStatement; import liquibase.structure.core.Table; import org.jboss.logging.Logger; -import org.keycloak.models.LDAPConstants; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.storage.UserStorageProvider; @@ -57,7 +56,7 @@ public abstract class AbstractUserFedToComponent extends CustomKeycloakTask { .addColumnValue("REALM_ID", realmId) .addColumnValue("PARENT_ID", realmId) .addColumnValue("NAME", displayName) - .addColumnValue("PROVIDER_ID", LDAPConstants.LDAP_PROVIDER) + .addColumnValue("PROVIDER_ID", providerId) .addColumnValue("PROVIDER_TYPE", UserStorageProvider.class.getName()); statements.add(insertComponent); 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 bb298300cc..bf3e92d33f 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 @@ -21,12 +21,15 @@ import liquibase.exception.CustomChangeException; import liquibase.statement.core.InsertStatement; import liquibase.structure.core.Table; import org.keycloak.keys.KeyProvider; +import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.LDAPConstants; import org.keycloak.models.utils.KeycloakModelUtils; +import org.keycloak.provider.ProviderFactory; import org.keycloak.storage.UserStorageProvider; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.util.List; /** * @author Bill Burke @@ -35,11 +38,14 @@ public class MigrateUserFedToComponent extends AbstractUserFedToComponent { @Override protected void generateStatementsImpl() throws CustomChangeException { - convertFedProviderToComponent("kerberos", null); + List factories = kcSession.getKeycloakSessionFactory().getProviderFactories(UserStorageProvider.class); + for (ProviderFactory factory : factories) { + convertFedProviderToComponent(factory.getId(), null); + } } @Override protected String getTaskId() { - return "Update 2.4.1.Final"; + return "Update 2.5.0.Final"; } } diff --git a/model/jpa/src/main/resources/META-INF/jpa-changelog-2.4.1.xml b/model/jpa/src/main/resources/META-INF/jpa-changelog-2.5.0.xml similarity index 97% rename from model/jpa/src/main/resources/META-INF/jpa-changelog-2.4.1.xml rename to model/jpa/src/main/resources/META-INF/jpa-changelog-2.5.0.xml index 543d8b6efe..4aee29165b 100755 --- a/model/jpa/src/main/resources/META-INF/jpa-changelog-2.4.1.xml +++ b/model/jpa/src/main/resources/META-INF/jpa-changelog-2.5.0.xml @@ -18,11 +18,11 @@ - + - + @@ -59,7 +59,7 @@ - + diff --git a/model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml b/model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml index 4fe18b6857..4b7f713dc8 100755 --- a/model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml +++ b/model/jpa/src/main/resources/META-INF/jpa-changelog-master.xml @@ -44,5 +44,5 @@ - + diff --git a/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java b/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java index 78adfb70c0..c82531bd84 100755 --- a/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java +++ b/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java @@ -35,7 +35,7 @@ import org.keycloak.connections.mongo.updater.impl.updates.Update1_8_0; import org.keycloak.connections.mongo.updater.impl.updates.Update1_9_2; import org.keycloak.connections.mongo.updater.impl.updates.Update2_3_0; import org.keycloak.connections.mongo.updater.impl.updates.Update2_4_0; -import org.keycloak.connections.mongo.updater.impl.updates.Update2_4_1; +import org.keycloak.connections.mongo.updater.impl.updates.Update2_5_0; import org.keycloak.models.KeycloakSession; import java.util.Date; @@ -63,7 +63,7 @@ public class DefaultMongoUpdaterProvider implements MongoUpdaterProvider { Update1_9_2.class, Update2_3_0.class, Update2_4_0.class, - Update2_4_1.class + Update2_5_0.class }; @Override diff --git a/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_4_1.java b/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_5_0.java similarity index 69% rename from model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_4_1.java rename to model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_5_0.java index 206579fb04..a46947bde4 100644 --- a/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_4_1.java +++ b/model/mongo/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update2_5_0.java @@ -19,20 +19,27 @@ package org.keycloak.connections.mongo.updater.impl.updates; import org.keycloak.models.KeycloakSession; import org.keycloak.models.LDAPConstants; +import org.keycloak.provider.ProviderFactory; +import org.keycloak.storage.UserStorageProvider; + +import java.util.List; /** * @author Marek Posolda */ -public class Update2_4_1 extends AbstractMigrateUserFedToComponent { +public class Update2_5_0 extends AbstractMigrateUserFedToComponent { @Override public String getId() { - return "2.4.1"; + return "2.5.0"; } @Override public void update(KeycloakSession session) { - portUserFedToComponent("kerberos"); + List factories = session.getKeycloakSessionFactory().getProviderFactories(UserStorageProvider.class); + for (ProviderFactory factory : factories) { + portUserFedToComponent(factory.getId()); + } } }