[java-identity-provider] branch master updated: IDP-1380 Move test source files overto new CA root
Rod Widdowson
rdw at steadingsoftware.com
Thu Dec 13 10:23:17 EST 2018
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=d96c0f2d050c1c47c82511ea7ee9ce1d44ba8038
The following commit(s) were added to refs/heads/master by this push:
new d96c0f2 IDP-1380 Move test source files overto new CA root
d96c0f2 is described below
commit d96c0f2d050c1c47c82511ea7ee9ce1d44ba8038
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Dec 13 11:47:47 2018 +0000
IDP-1380 Move test source files overto new CA root
https://issues.shibboleth.net/jira/browse/IDP-1380
Largely involves "just" pluggin in the new CA. We can supress the test for
an explicit CA since everything is explicit and we have no way to test implicit
(which kinda deprecate).
---
idp-attribute-resolver-impl/pom.xml | 6 ++++
.../dc/http/impl/HTTPDataConnectorTest.java | 28 +++++++++-------
.../dc/http/HTTPDataConnectorParserTest.java | 38 +++++-----------------
.../dc/http/http-attribute-resolver-v2-ca.xml | 18 ----------
.../http/http-attribute-resolver-v2-clientcert.xml | 1 +
.../dc/http/http-attribute-resolver-v2-hybrid.xml | 3 +-
.../spring/dc/http/http-attribute-resolver-v2.xml | 3 +-
.../resolver/spring/dc/http/spring-beans.xml | 2 +-
8 files changed, 37 insertions(+), 62 deletions(-)
diff --git a/idp-attribute-resolver-impl/pom.xml b/idp-attribute-resolver-impl/pom.xml
index 8434b47..d51cb5a 100644
--- a/idp-attribute-resolver-impl/pom.xml
+++ b/idp-attribute-resolver-impl/pom.xml
@@ -140,6 +140,12 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${opensaml.groupId}</groupId>
+ <artifactId>opensaml-saml-impl</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<distributionManagement>
diff --git a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/HTTPDataConnectorTest.java b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/HTTPDataConnectorTest.java
index 0e282ff..aa458c2 100644
--- a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/HTTPDataConnectorTest.java
+++ b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/HTTPDataConnectorTest.java
@@ -24,7 +24,7 @@ import java.util.Map;
import javax.script.ScriptException;
import org.apache.http.HttpStatus;
-import org.apache.http.impl.client.HttpClientBuilder;
+import org.opensaml.saml.metadata.resolver.impl.HTTPMetadataResolverTest;
import org.opensaml.security.httpclient.HttpClientSecurityParameters;
import org.opensaml.security.httpclient.impl.SecurityEnhancedHttpClientSupport;
import org.springframework.core.io.ClassPathResource;
@@ -39,6 +39,7 @@ import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.dc.impl.TestCache;
import net.shibboleth.idp.saml.impl.TestSources;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
import net.shibboleth.utilities.java.support.repository.RepositorySupport;
import net.shibboleth.utilities.java.support.testing.TestSupport;
import net.shibboleth.utilities.java.support.velocity.VelocityEngine;
@@ -51,8 +52,8 @@ public class HTTPDataConnectorTest {
private static final String TEST_CONNECTOR_NAME = "HTTPConnector";
private static final String TEST_URL =
- RepositorySupport.buildHTTPSResourceURL("java-identity-provider",
- "idp-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/dc/http/test.json");
+ RepositorySupport.buildHTTPResourceURL("java-identity-provider",
+ "idp-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/dc/http/test.json", false);
private static final String SCRIPT_PATH = "/net/shibboleth/idp/attribute/resolver/impl/dc/http/";
@@ -60,13 +61,12 @@ public class HTTPDataConnectorTest {
private HTTPDataConnector connector;
- @BeforeMethod public void setUp() {
+ @BeforeMethod public void setUp() throws Exception {
connector = new HTTPDataConnector();
connector.setId(TEST_CONNECTOR_NAME);
- connector.setHttpClient(
- HttpClientBuilder.create()
- .setSSLSocketFactory(SecurityEnhancedHttpClientSupport.buildTLSSocketFactory(false, false))
- .build());
+ final HttpClientBuilder builder = new HttpClientBuilder();
+ builder.setTLSSocketFactory(SecurityEnhancedHttpClientSupport.buildTLSSocketFactory(false, false));
+ connector.setHttpClient(builder.buildClient());
}
@Test public void test() throws ComponentInitializationException, ResolutionException, ScriptException, IOException {
@@ -107,13 +107,19 @@ public class HTTPDataConnectorTest {
}
@Test(expectedExceptions=ResolutionException.class) public void testBadProtocol()
- throws ComponentInitializationException, ResolutionException, ScriptException, IOException {
+ throws Exception {
+ final HttpClientBuilder clientBuilder = new HttpClientBuilder();
+ clientBuilder.setTLSSocketFactory(HTTPMetadataResolverTest.buildTrustEngineSocketFactory());
+ connector.setHttpClient(clientBuilder.buildClient());
+
final HttpClientSecurityParameters params = new HttpClientSecurityParameters();
params.setTLSProtocols(Collections.singleton("SSLv3"));
+ params.setTLSTrustEngine(HTTPMetadataResolverTest.buildExplicitKeyTrustEngine("repo-entity.crt"));
connector.setHttpClientSecurityParameters(params);
-
+
final TemplatedURLBuilder builder = new TemplatedURLBuilder();
- builder.setTemplateText(TEST_URL);
+ builder.setTemplateText(RepositorySupport.buildHTTPSResourceURL("java-identity-provider",
+ "idp-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/dc/http/test.json"));
builder.setVelocityEngine(VelocityEngine.newVelocityEngine());
builder.setHttpClientSecurityParameters(params);
builder.initialize();
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/HTTPDataConnectorParserTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/HTTPDataConnectorParserTest.java
index 7673949..723ebed 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/HTTPDataConnectorParserTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/HTTPDataConnectorParserTest.java
@@ -75,6 +75,7 @@ public class HTTPDataConnectorParserTest {
final MockPropertySource propSource = singletonPropertySource("serviceURL", TEST_URL);
propSource.setProperty("scriptPath", (TestSupport.isJavaV8OrLater() ? SCRIPT_PATH_V8 : SCRIPT_PATH) + "test.js");
propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
+ propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
final HTTPDataConnector connector =
getDataConnector(propSource,
@@ -122,6 +123,8 @@ public class HTTPDataConnectorParserTest {
final MockPropertySource propSource = singletonPropertySource("serviceURL", TEST_URL);
propSource.setProperty("scriptPath", (TestSupport.isJavaV8OrLater() ? SCRIPT_PATH_V8 : SCRIPT_PATH) + "testsize.js");
propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
+ propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
+
final HTTPDataConnector connector =
getDataConnector(propSource,
@@ -140,6 +143,8 @@ public class HTTPDataConnectorParserTest {
final MockPropertySource propSource = singletonPropertySource("serviceURL", "https://build.shibboleth.net/test.json");
propSource.setProperty("scriptPath", (TestSupport.isJavaV8OrLater() ? SCRIPT_PATH_V8 : SCRIPT_PATH) + "test.js");
propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
+ propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
+
final HTTPDataConnector connector =
getDataConnector(propSource,
@@ -222,36 +227,6 @@ public class HTTPDataConnectorParserTest {
connector.resolve(context);
}
- @Test public void v2CA() throws Exception {
-
- final MockPropertySource propSource = singletonPropertySource("serviceURL", TEST_URL);
- propSource.setProperty("scriptPath", (TestSupport.isJavaV8OrLater() ? SCRIPT_PATH_V8 : SCRIPT_PATH) + "test.js");
- propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
- propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
-
- final HTTPDataConnector connector =
- getDataConnector(propSource,
- "net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-ca.xml");
- Assert.assertNotNull(connector);
-
- final AttributeResolutionContext context =
- TestSources.createResolutionContext(TestSources.PRINCIPAL_ID, TestSources.IDP_ENTITY_ID,
- TestSources.SP_ENTITY_ID);
-
- connector.resolve(context);
-
- final Map<String,IdPAttribute> attrs = connector.resolve(context);
-
- Assert.assertEquals(attrs.size(), 2);
-
- Assert.assertEquals(attrs.get("foo").getValues().size(), 1);
- Assert.assertEquals(attrs.get("foo").getValues().get(0).getValue(), "foo1");
-
- Assert.assertEquals(attrs.get("bar").getValues().size(), 2);
- Assert.assertEquals(attrs.get("bar").getValues().get(0).getValue(), "bar1");
- Assert.assertEquals(attrs.get("bar").getValues().get(1).getValue(), "bar2");
- }
-
@Test(expectedExceptions=ResolutionException.class) public void v2BadCA() throws Exception {
final MockPropertySource propSource = singletonPropertySource("serviceURL", TEST_URL);
@@ -280,6 +255,8 @@ public class HTTPDataConnectorParserTest {
propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
propSource.setProperty("key", "net/shibboleth/idp/attribute/resolver/spring/dc/http/client.key");
propSource.setProperty("certificate", "net/shibboleth/idp/attribute/resolver/spring/dc/http/client.crt");
+ propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
+
final HTTPDataConnector connector =
getDataConnector(propSource,
@@ -308,6 +285,7 @@ public class HTTPDataConnectorParserTest {
final MockPropertySource propSource = singletonPropertySource("serviceURL", TEST_URL);
propSource.setProperty("scriptPath", (TestSupport.isJavaV8OrLater() ? SCRIPT_PATH_V8 : SCRIPT_PATH) + "test.js");
propSource.setProperty("userAgent", "disguised/1.0.0 hidden/3.4.5");
+ propSource.setProperty("certificateAuthority", "/org/opensaml/saml/metadata/resolver/impl/repo-rootCA.crt");
final HTTPDataConnector connector =
getDataConnector(propSource,
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-ca.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-ca.xml
deleted file mode 100644
index 5abd7ae..0000000
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-ca.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<AttributeResolver
- xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
-
- <DataConnector id="myHTTP" xsi:type="HTTP"
- httpClientRef="TrustEngineHttpClient"
- certificateAuthority="%{certificateAuthority}">
-
- <URLTemplate>%{serviceURL}</URLTemplate>
-
- <ResponseMapping>
- <ScriptFile>%{scriptPath}</ScriptFile>
- </ResponseMapping>
-
- </DataConnector>
-
-</AttributeResolver>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-clientcert.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-clientcert.xml
index 75b8ffc..78fe56a 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-clientcert.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-clientcert.xml
@@ -6,6 +6,7 @@
<DataConnector id="myHTTP" xsi:type="HTTP"
httpClientRef="ClientTLSHttpClient"
clientPrivateKey="%{key}"
+ certificateAuthority="%{certificateAuthority}"
clientCertificate="%{certificate}">
<URLTemplate>%{serviceURL}</URLTemplate>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-hybrid.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-hybrid.xml
index e73d4d2..881459c 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-hybrid.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-hybrid.xml
@@ -4,8 +4,9 @@
xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
<DataConnector id="myHTTP" xsi:type="HTTP"
- httpClientRef="NoTrustEngineHttpClient"
+ httpClientRef="TrustEngineHttpClient"
executableSearchBuilderRef="template"
+ certificateAuthority="%{certificateAuthority}"
mappingStrategyRef="mapping">
<ResultCacheBean>cache</ResultCacheBean>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2.xml
index cb012c9..d1bc3de 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2.xml
@@ -4,8 +4,9 @@
xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd">
<DataConnector id="myHTTP" xsi:type="HTTP"
- httpClientRef="NoTrustEngineHttpClient"
acceptStatuses="200 201"
+ httpClientRef="TrustEngineHttpClient"
+ certificateAuthority="%{certificateAuthority}"
acceptTypes="application/json">
<URLTemplate customObjectRef="CustomObject">%{serviceURL}</URLTemplate>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/spring-beans.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/spring-beans.xml
index 4ff8c71..1cfcea9 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/spring-beans.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/spring-beans.xml
@@ -27,7 +27,7 @@
<bean id="ClientTLSSocketFactory"
class="org.opensaml.security.httpclient.impl.SecurityEnhancedHttpClientSupport"
- factory-method="buildTLSSocketFactoryWithClientTLSOnly" />
+ factory-method="buildTLSSocketFactoryWithClientTLS" />
<bean id="ClientTLSHttpClientBuilder"
parent="NoTrustEngineHttpClientBuilder"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list