diff --git a/.travis.yml b/.travis.yml index ad8a23f5e35..59e89ac3540 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: java jdk: - - openjdk7 - oraclejdk8 branches: diff --git a/build.gradle b/build.gradle index a3ea5349995..58bfcab55bc 100644 --- a/build.gradle +++ b/build.gradle @@ -75,8 +75,8 @@ allprojects { subprojects { apply plugin: 'java' [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:none'] - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + sourceCompatibility = 1.8 + targetCompatibility = 1.8 test { jvmArgs += [ "-XX:MaxPermSize=512m", "-Xmx2048m" ] } diff --git a/common/src/main/java/org/cloudfoundry/identity/uaa/db/Create_Groups_For_Zones_2_5_2.java b/common/src/main/java/org/cloudfoundry/identity/uaa/db/Create_Groups_For_Zones_2_5_2.java index 86a3a41013b..d06c7a555c8 100644 --- a/common/src/main/java/org/cloudfoundry/identity/uaa/db/Create_Groups_For_Zones_2_5_2.java +++ b/common/src/main/java/org/cloudfoundry/identity/uaa/db/Create_Groups_For_Zones_2_5_2.java @@ -19,6 +19,7 @@ import org.apache.commons.logging.LogFactory; import org.flywaydb.core.api.migration.spring.SpringJdbcMigration; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.util.StringUtils; import java.sql.Timestamp; import java.util.HashMap; @@ -74,9 +75,13 @@ public void migrate(JdbcTemplate jdbcTemplate) throws Exception { } } else { String groupId = groupNameToGroupId.get(displayName); - int count = jdbcTemplate.update("UPDATE group_membership SET group_id=? WHERE group_id=? AND member_id=?",groupId, oldGroupId, memberId); - if (count!=1) { - logger.error("Unable to update group membership for migrated zone(old group:"+oldGroupId+", member:"+memberId+", new group:"+groupId+")"); + if (StringUtils.hasText(groupId)) { + int count = jdbcTemplate.update("UPDATE group_membership SET group_id=? WHERE group_id=? AND member_id=?", groupId, oldGroupId, memberId); + if (count != 1) { + logger.error("Unable to update group membership for migrated zone(old group:" + oldGroupId + ", member:" + memberId + ", new group:" + groupId + ")"); + } + } else { + logger.error("Will not migrate (old group:" + oldGroupId + ", member:" + memberId + ", new group:" + groupId + "). Incorrectly mapped zones group? ("+displayName+")"); } } } diff --git a/common/src/main/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfigurator.java b/common/src/main/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfigurator.java index 628ca911937..b9b6ffd47a2 100644 --- a/common/src/main/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfigurator.java +++ b/common/src/main/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfigurator.java @@ -13,6 +13,8 @@ package org.cloudfoundry.identity.uaa.login.saml; import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.SimpleHttpConnectionManager; +import org.apache.commons.httpclient.params.HttpClientParams; import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; import org.apache.http.client.utils.URIBuilder; import org.cloudfoundry.identity.uaa.login.util.FileLocator; @@ -46,7 +48,7 @@ public class IdentityProviderConfigurator implements InitializingBean { private boolean legacyShowSamlLink = true; private List identityProviders = new LinkedList<>(); private Timer metadataFetchingHttpClientTimer; - private HttpClient httpClient; + private HttpClientParams clientParams; private BasicParserPool parserPool; public List getIdentityProviderDefinitions() { @@ -230,7 +232,10 @@ protected ExtendedMetadataDelegate configureURLMetadata(IdentityProviderDefiniti socketFactory = (Class) Class.forName(def.getSocketFactoryClassName()); ExtendedMetadata extendedMetadata = new ExtendedMetadata(); extendedMetadata.setAlias(def.getIdpEntityAlias()); - FixedHttpMetaDataProvider fixedHttpMetaDataProvider = new FixedHttpMetaDataProvider(def.getZoneId(), def.getIdpEntityAlias(), getMetadataFetchingHttpClientTimer(), getHttpClient(), adjustURIForPort(def.getMetaDataLocation())); + SimpleHttpConnectionManager connectionManager = new SimpleHttpConnectionManager(true); + connectionManager.getParams().setDefaults(getClientParams()); + HttpClient client = new HttpClient(connectionManager); + FixedHttpMetaDataProvider fixedHttpMetaDataProvider = new FixedHttpMetaDataProvider(def.getZoneId(), def.getIdpEntityAlias(), getMetadataFetchingHttpClientTimer(), client, adjustURIForPort(def.getMetaDataLocation())); fixedHttpMetaDataProvider.setParserPool(getParserPool()); //TODO - we have no way of actually instantiating this object unless it has a zero arg constructor fixedHttpMetaDataProvider.setSocketFactory(socketFactory.newInstance()); @@ -358,12 +363,12 @@ public void setMetadataFetchingHttpClientTimer(Timer metadataFetchingHttpClientT this.metadataFetchingHttpClientTimer = metadataFetchingHttpClientTimer; } - public HttpClient getHttpClient() { - return httpClient; + public HttpClientParams getClientParams() { + return clientParams; } - public void setHttpClient(HttpClient httpClient) { - this.httpClient = httpClient; + public void setClientParams(HttpClientParams clientParams) { + this.clientParams = clientParams; } public BasicParserPool getParserPool() { diff --git a/common/src/test/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfiguratorTests.java b/common/src/test/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfiguratorTests.java index 8f3ac84d9e1..9b029b1216c 100644 --- a/common/src/test/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfiguratorTests.java +++ b/common/src/test/java/org/cloudfoundry/identity/uaa/login/saml/IdentityProviderConfiguratorTests.java @@ -13,6 +13,7 @@ package org.cloudfoundry.identity.uaa.login.saml; import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.params.HttpClientParams; import org.cloudfoundry.identity.uaa.client.ClientConstants; import org.cloudfoundry.identity.uaa.config.YamlMapFactoryBean; import org.cloudfoundry.identity.uaa.config.YamlProcessor; @@ -346,7 +347,7 @@ public void testGetIdentityProviders() throws Exception { conf.setLegacyIdpIdentityAlias("vsphere.local.legacy"); conf.setLegacyNameId("urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"); conf.setMetadataFetchingHttpClientTimer(new Timer()); - conf.setHttpClient(new HttpClient()); + conf.setClientParams(new HttpClientParams()); testGetIdentityProviderDefinitions(6); conf.getIdentityProviders(); } diff --git a/gradle.properties b/gradle.properties index ad14246d22a..17abd57ca94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=2.5.2 +version=2.6.0 diff --git a/uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml b/uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml index 73bc9d7940e..2cb44b17011 100644 --- a/uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml +++ b/uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml @@ -121,10 +121,6 @@ - - - - @@ -269,7 +265,7 @@ - +