diff --git a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.xml similarity index 99% rename from connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml rename to connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.xml index 41c3ac85bf..db1adb8309 100755 --- a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml +++ b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.xml @@ -1,6 +1,6 @@ - + diff --git a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-master.xml b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-master.xml index 76c4507374..f3f3f9039b 100755 --- a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-master.xml +++ b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-master.xml @@ -6,5 +6,5 @@ - + diff --git a/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java b/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java index c8097f6cf9..3ca2bff383 100644 --- a/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java +++ b/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/DefaultMongoUpdaterProvider.java @@ -27,7 +27,7 @@ public class DefaultMongoUpdaterProvider implements MongoUpdaterProvider { Update1_1_0_Beta1.class, Update1_2_0_Beta1.class, Update1_2_0_CR1.class, - Update1_3_0_Beta1.class + Update1_3_0.class }; @Override diff --git a/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0_Beta1.java b/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0.java similarity index 96% rename from connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0_Beta1.java rename to connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0.java index f834d22b1d..b2273333ef 100644 --- a/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0_Beta1.java +++ b/connections/mongo-update/src/main/java/org/keycloak/connections/mongo/updater/impl/updates/Update1_3_0.java @@ -10,11 +10,11 @@ import org.keycloak.representations.idm.IdentityProviderRepresentation; /** * @author Marek Posolda */ -public class Update1_3_0_Beta1 extends Update { +public class Update1_3_0 extends Update { @Override public String getId() { - return "1.3.0.Beta1"; + return "1.3.0"; } @Override diff --git a/model/api/src/main/java/org/keycloak/migration/MigrationModelManager.java b/model/api/src/main/java/org/keycloak/migration/MigrationModelManager.java index 5d58fe1b1a..722bc5e021 100755 --- a/model/api/src/main/java/org/keycloak/migration/MigrationModelManager.java +++ b/model/api/src/main/java/org/keycloak/migration/MigrationModelManager.java @@ -1,7 +1,7 @@ package org.keycloak.migration; import org.jboss.logging.Logger; -import org.keycloak.migration.migrators.MigrateTo1_3_0_Beta1; +import org.keycloak.migration.migrators.MigrateTo1_3_0; import org.keycloak.migration.migrators.MigrationTo1_2_0_CR1; import org.keycloak.models.KeycloakSession; @@ -27,11 +27,11 @@ public class MigrationModelManager { } new MigrationTo1_2_0_CR1().migrate(session); } - if (stored == null || stored.lessThan(MigrateTo1_3_0_Beta1.VERSION)) { + if (stored == null || stored.lessThan(MigrateTo1_3_0.VERSION)) { if (stored != null) { - logger.debug("Migrating older model to 1.3.0.Beta1 updates"); + logger.debug("Migrating older model to 1.3.0 updates"); } - new MigrateTo1_3_0_Beta1().migrate(session); + new MigrateTo1_3_0().migrate(session); } model.setStoredVersion(MigrationModel.LATEST_VERSION); diff --git a/model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0_Beta1.java b/model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java similarity index 96% rename from model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0_Beta1.java rename to model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java index 195910b2f7..1b68528ee4 100755 --- a/model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0_Beta1.java +++ b/model/api/src/main/java/org/keycloak/migration/migrators/MigrateTo1_3_0.java @@ -1,84 +1,84 @@ -package org.keycloak.migration.migrators; - -import org.keycloak.migration.ModelVersion; -import org.keycloak.models.KeycloakSession; -import org.keycloak.models.LDAPConstants; -import org.keycloak.models.RealmModel; -import org.keycloak.models.UserFederationEventAwareProviderFactory; -import org.keycloak.models.UserFederationMapperModel; -import org.keycloak.models.UserFederationProvider; -import org.keycloak.models.UserFederationProviderFactory; -import org.keycloak.models.UserFederationProviderModel; -import org.keycloak.models.utils.DefaultAuthenticationFlows; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.naming.directory.SearchControls; - -/** - * @author Bill Burke - * @version $Revision: 1 $ - */ -public class MigrateTo1_3_0_Beta1 { - public static final ModelVersion VERSION = new ModelVersion("1.3.0.Beta1"); - - - public void migrate(KeycloakSession session) { - List realms = session.realms().getRealms(); - for (RealmModel realm : realms) { - if (realm.getAuthenticationFlows().size() == 0) { - DefaultAuthenticationFlows.addFlows(realm); - } - - migrateLDAPProviders(session, realm); - } - - } - - private void migrateLDAPProviders(KeycloakSession session, RealmModel realm) { - List federationProviders = realm.getUserFederationProviders(); - for (UserFederationProviderModel fedProvider : federationProviders) { - - if (fedProvider.getProviderName().equals(LDAPConstants.LDAP_PROVIDER)) { - Map config = fedProvider.getConfig(); - - // Update config properties for LDAP federation provider - if (config.get(LDAPConstants.SEARCH_SCOPE) == null) { - config.put(LDAPConstants.SEARCH_SCOPE, String.valueOf(SearchControls.SUBTREE_SCOPE)); - } - - String usersDn = config.remove("userDnSuffix"); - if (usersDn != null && config.get(LDAPConstants.USERS_DN) == null) { - config.put(LDAPConstants.USERS_DN, usersDn); - } - - String usernameLdapAttribute = config.get(LDAPConstants.USERNAME_LDAP_ATTRIBUTE); - if (usernameLdapAttribute != null && config.get(LDAPConstants.RDN_LDAP_ATTRIBUTE) == null) { - if (usernameLdapAttribute.equalsIgnoreCase(LDAPConstants.SAM_ACCOUNT_NAME)) { - config.put(LDAPConstants.RDN_LDAP_ATTRIBUTE, LDAPConstants.CN); - } else { - config.put(LDAPConstants.RDN_LDAP_ATTRIBUTE, usernameLdapAttribute); - } - } - - if (config.get(LDAPConstants.UUID_LDAP_ATTRIBUTE) == null) { - String uuidAttrName = LDAPConstants.getUuidAttributeName(config.get(LDAPConstants.VENDOR)); - config.put(LDAPConstants.UUID_LDAP_ATTRIBUTE, uuidAttrName); - } - - realm.updateUserFederationProvider(fedProvider); - - // Create default mappers for LDAP - Set mappers = realm.getUserFederationMappersByFederationProvider(fedProvider.getId()); - if (mappers.isEmpty()) { - UserFederationProviderFactory ldapFactory = (UserFederationProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(UserFederationProvider.class, LDAPConstants.LDAP_PROVIDER); - if (ldapFactory != null) { - ((UserFederationEventAwareProviderFactory) ldapFactory).onProviderModelCreated(realm, fedProvider); - } - } - } - } - } -} +package org.keycloak.migration.migrators; + +import org.keycloak.migration.ModelVersion; +import org.keycloak.models.KeycloakSession; +import org.keycloak.models.LDAPConstants; +import org.keycloak.models.RealmModel; +import org.keycloak.models.UserFederationEventAwareProviderFactory; +import org.keycloak.models.UserFederationMapperModel; +import org.keycloak.models.UserFederationProvider; +import org.keycloak.models.UserFederationProviderFactory; +import org.keycloak.models.UserFederationProviderModel; +import org.keycloak.models.utils.DefaultAuthenticationFlows; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.naming.directory.SearchControls; + +/** + * @author Bill Burke + * @version $Revision: 1 $ + */ +public class MigrateTo1_3_0 { + public static final ModelVersion VERSION = new ModelVersion("1.3.0"); + + + public void migrate(KeycloakSession session) { + List realms = session.realms().getRealms(); + for (RealmModel realm : realms) { + if (realm.getAuthenticationFlows().size() == 0) { + DefaultAuthenticationFlows.addFlows(realm); + } + + migrateLDAPProviders(session, realm); + } + + } + + private void migrateLDAPProviders(KeycloakSession session, RealmModel realm) { + List federationProviders = realm.getUserFederationProviders(); + for (UserFederationProviderModel fedProvider : federationProviders) { + + if (fedProvider.getProviderName().equals(LDAPConstants.LDAP_PROVIDER)) { + Map config = fedProvider.getConfig(); + + // Update config properties for LDAP federation provider + if (config.get(LDAPConstants.SEARCH_SCOPE) == null) { + config.put(LDAPConstants.SEARCH_SCOPE, String.valueOf(SearchControls.SUBTREE_SCOPE)); + } + + String usersDn = config.remove("userDnSuffix"); + if (usersDn != null && config.get(LDAPConstants.USERS_DN) == null) { + config.put(LDAPConstants.USERS_DN, usersDn); + } + + String usernameLdapAttribute = config.get(LDAPConstants.USERNAME_LDAP_ATTRIBUTE); + if (usernameLdapAttribute != null && config.get(LDAPConstants.RDN_LDAP_ATTRIBUTE) == null) { + if (usernameLdapAttribute.equalsIgnoreCase(LDAPConstants.SAM_ACCOUNT_NAME)) { + config.put(LDAPConstants.RDN_LDAP_ATTRIBUTE, LDAPConstants.CN); + } else { + config.put(LDAPConstants.RDN_LDAP_ATTRIBUTE, usernameLdapAttribute); + } + } + + if (config.get(LDAPConstants.UUID_LDAP_ATTRIBUTE) == null) { + String uuidAttrName = LDAPConstants.getUuidAttributeName(config.get(LDAPConstants.VENDOR)); + config.put(LDAPConstants.UUID_LDAP_ATTRIBUTE, uuidAttrName); + } + + realm.updateUserFederationProvider(fedProvider); + + // Create default mappers for LDAP + Set mappers = realm.getUserFederationMappersByFederationProvider(fedProvider.getId()); + if (mappers.isEmpty()) { + UserFederationProviderFactory ldapFactory = (UserFederationProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(UserFederationProvider.class, LDAPConstants.LDAP_PROVIDER); + if (ldapFactory != null) { + ((UserFederationEventAwareProviderFactory) ldapFactory).onProviderModelCreated(realm, fedProvider); + } + } + } + } + } +}