Skip to content

Commit

Permalink
Merge branch 'releases/2.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fhanik committed Aug 11, 2015
2 parents 62c941c + 7bbd118 commit 82dc8fe
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: java
jdk:
- openjdk7
- oraclejdk8

branches:
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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+")");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -46,7 +48,7 @@ public class IdentityProviderConfigurator implements InitializingBean {
private boolean legacyShowSamlLink = true;
private List<IdentityProviderDefinition> identityProviders = new LinkedList<>();
private Timer metadataFetchingHttpClientTimer;
private HttpClient httpClient;
private HttpClientParams clientParams;
private BasicParserPool parserPool;

public List<IdentityProviderDefinition> getIdentityProviderDefinitions() {
Expand Down Expand Up @@ -230,7 +232,10 @@ protected ExtendedMetadataDelegate configureURLMetadata(IdentityProviderDefiniti
socketFactory = (Class<ProtocolSocketFactory>) 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());
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.5.2
version=2.6.0
6 changes: 1 addition & 5 deletions uaa/src/main/webapp/WEB-INF/spring/saml-providers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,6 @@
<constructor-arg value="true" />
</bean>

<bean name="metadataFetchingHttpClient" class="org.apache.commons.httpclient.HttpClient">
<constructor-arg ref="httpClientParams" />
</bean>

<bean name="httpClientParams" class="org.apache.commons.httpclient.params.HttpClientParams">
<property name="connectionManagerTimeout" value="${login.saml.socket.connectionManagerTimeout:10000}" />
<property name="soTimeout" value="${login.saml.socket.soTimeout:10000}" />
Expand Down Expand Up @@ -269,7 +265,7 @@
<property name="legacyMetadataTrustCheck" value="${login.saml.metadataTrustCheck:true}"/>
<property name="legacyShowSamlLink" value="${login.showSamlLoginLink:true}"/>
<property name="metadataFetchingHttpClientTimer" ref="metadataFetchingHttpClientTimer" />
<property name="httpClient" ref="metadataFetchingHttpClient" />
<property name="clientParams" ref="httpClientParams" />
<property name="parserPool" ref="parserPool"/>
</bean>

Expand Down

0 comments on commit 82dc8fe

Please sign in to comment.