KEYCLOAK-3973

This commit is contained in:
Bill Burke 2016-12-07 12:56:03 -05:00
parent b8c06dd560
commit 223cc1fb50
5 changed files with 24 additions and 11 deletions

View file

@ -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 <a href="mailto:bburke@redhat.com">Bill Burke</a>
@ -35,11 +38,14 @@ public class MigrateUserFedToComponent extends AbstractUserFedToComponent {
@Override
protected void generateStatementsImpl() throws CustomChangeException {
convertFedProviderToComponent("kerberos", null);
List<ProviderFactory> 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";
}
}

View file

@ -18,11 +18,11 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="bburke@redhat.com" id="2.4.1">
<changeSet author="bburke@redhat.com" id="2.5.0">
<customChange class="org.keycloak.connections.jpa.updater.liquibase.custom.MigrateUserFedToComponent"/>
</changeSet>
<changeSet author="hmlnarik@redhat.com" id="2.4.1-unicode-oracle">
<changeSet author="hmlnarik@redhat.com" id="2.5.0-unicode-oracle">
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
<dbms type="oracle" />
</preConditions>
@ -59,7 +59,7 @@
<modifyDataType tableName="KEYCLOAK_ROLE" columnName="DESCRIPTION" newDataType="NVARCHAR(255)"/>
</changeSet>
<changeSet author="hmlnarik@redhat.com" id="2.4.1-unicode-other-dbs">
<changeSet author="hmlnarik@redhat.com" id="2.5.0-unicode-other-dbs">
<preConditions onSqlOutput="TEST" onFail="MARK_RAN">
<not>
<dbms type="oracle" />

View file

@ -44,5 +44,5 @@
<include file="META-INF/jpa-changelog-2.2.0.xml"/>
<include file="META-INF/jpa-changelog-2.3.0.xml"/>
<include file="META-INF/jpa-changelog-2.4.0.xml"/>
<include file="META-INF/jpa-changelog-2.4.1.xml"/>
<include file="META-INF/jpa-changelog-2.5.0.xml"/>
</databaseChangeLog>

View file

@ -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

View file

@ -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 <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/
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<ProviderFactory> factories = session.getKeycloakSessionFactory().getProviderFactories(UserStorageProvider.class);
for (ProviderFactory factory : factories) {
portUserFedToComponent(factory.getId());
}
}
}