[java-identity-provider] branch master updated: JSPT-33 - Refactor HttpClient builders and factory beans
Scott Cantor
cantor.2 at osu.edu
Wed Mar 6 18:29:37 EST 2019
This is an automated email from the git hooks/post-receive script.
scantor 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=d17930ee4d7000227cb9290e366a5d83a48ecb70
The following commit(s) were added to refs/heads/master by this push:
new d17930e JSPT-33 - Refactor HttpClient builders and factory beans
d17930e is described below
commit d17930ee4d7000227cb9290e366a5d83a48ecb70
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Mar 6 18:29:35 2019 -0500
JSPT-33 - Refactor HttpClient builders and factory beans
https://issues.shibboleth.net/jira/browse/JSPT-33
Also converts duration properties to Duration type.
---
.../dc/http/HTTPDataConnectorParserTest.java | 8 +++--
.../resolver/spring/dc/http/spring-beans.xml | 18 ++++-------
.../idp/http/FileCachingHttpClientBuilder.java | 37 ----------------------
.../net/shibboleth/idp/http/HttpClientBuilder.java | 36 ---------------------
.../idp/http/InMemoryCachingHttpClientBuilder.java | 37 ----------------------
.../java/net/shibboleth/idp/http/package-info.java | 22 -------------
.../metadata/AbstractMetadataParserTest.java | 2 ++
.../spring/relyingparty/metadata/parent.xml | 1 +
8 files changed, 15 insertions(+), 146 deletions(-)
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 c7df46f..0d95fed 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
@@ -346,8 +346,12 @@ public class HTTPDataConnectorParserTest {
context.setDisplayName("ApplicationContext: " + HTTPDataConnectorParserTest.class);
final ConversionServiceFactoryBean service = new ConversionServiceFactoryBean();
- service.setConverters(new HashSet<>(Arrays.asList(new DurationToLongConverter(), new StringToIPRangeConverter(),
- new StringToResourceConverter(), new StringToDurationConverter())));
+ service.setConverters(new HashSet<>(Arrays.asList(
+ new DurationToLongConverter(),
+ new StringToDurationConverter(),
+ new StringToIPRangeConverter(),
+ new StringToResourceConverter(),
+ new StringToDurationConverter())));
service.afterPropertiesSet();
context.getBeanFactory().setConversionService(service.getObject());
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 1cfcea9..8f80198 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
@@ -8,32 +8,26 @@
<bean id="CustomObject" class="java.lang.String" c:_0="foo" />
- <bean id="NoTrustEngineHttpClientBuilder"
- class="net.shibboleth.idp.http.HttpClientBuilder"
+ <bean id="NoTrustEngineHttpClient"
+ class="net.shibboleth.idp.profile.spring.relyingparty.metadata.HttpClientFactoryBean"
p:userAgent="%{userAgent}"
p:connectionTimeout="PT30S" />
- <bean id="NoTrustEngineHttpClient" factory-bean="NoTrustEngineHttpClientBuilder" factory-method="buildClient" />
-
<bean id="SecurityEnhancedTLSSocketFactory"
class="org.opensaml.security.httpclient.impl.SecurityEnhancedHttpClientSupport"
factory-method="buildTLSSocketFactory" />
- <bean id="TrustEngineHttpClientBuilder"
- parent="NoTrustEngineHttpClientBuilder"
+ <bean id="TrustEngineHttpClient"
+ parent="NoTrustEngineHttpClient"
p:TLSSocketFactory-ref="SecurityEnhancedTLSSocketFactory" />
- <bean id="TrustEngineHttpClient" factory-bean="TrustEngineHttpClientBuilder" factory-method="buildClient" />
-
<bean id="ClientTLSSocketFactory"
class="org.opensaml.security.httpclient.impl.SecurityEnhancedHttpClientSupport"
factory-method="buildTLSSocketFactoryWithClientTLS" />
- <bean id="ClientTLSHttpClientBuilder"
- parent="NoTrustEngineHttpClientBuilder"
+ <bean id="ClientTLSHttpClient"
+ parent="NoTrustEngineHttpClient"
p:TLSSocketFactory-ref="ClientTLSSocketFactory" />
-
- <bean id="ClientTLSHttpClient" factory-bean="ClientTLSHttpClientBuilder" factory-method="buildClient" />
<bean id="BadProtocolParameters"
class="org.opensaml.security.httpclient.HttpClientSecurityParameters"
diff --git a/idp-core/src/main/java/net/shibboleth/idp/http/FileCachingHttpClientBuilder.java b/idp-core/src/main/java/net/shibboleth/idp/http/FileCachingHttpClientBuilder.java
deleted file mode 100644
index aff239a..0000000
--- a/idp-core/src/main/java/net/shibboleth/idp/http/FileCachingHttpClientBuilder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.http;
-
-import net.shibboleth.idp.Version;
-
-/**
- * FileCachingHttpClientBuilder customization for the Shibboleth IdP.
- */
-public class FileCachingHttpClientBuilder
- extends net.shibboleth.utilities.java.support.httpclient.FileCachingHttpClientBuilder {
-
- /**
- * Constructor.
- */
- public FileCachingHttpClientBuilder() {
- final StringBuilder stringBuilder = new StringBuilder("ShibbolethIdp/");
- stringBuilder.append(Version.getVersion()).append(" OpenSAML/").append(org.opensaml.core.Version.getVersion());
- setUserAgent(stringBuilder.toString());
- }
-
-}
\ No newline at end of file
diff --git a/idp-core/src/main/java/net/shibboleth/idp/http/HttpClientBuilder.java b/idp-core/src/main/java/net/shibboleth/idp/http/HttpClientBuilder.java
deleted file mode 100644
index e45ee41..0000000
--- a/idp-core/src/main/java/net/shibboleth/idp/http/HttpClientBuilder.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.http;
-
-import net.shibboleth.idp.Version;
-
-/**
- * HttpClientBuilder customization for the Shibboleth IdP.
- */
-public class HttpClientBuilder extends net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder {
-
- /**
- * Constructor.
- */
- public HttpClientBuilder() {
- final StringBuilder stringBuilder = new StringBuilder("ShibbolethIdp/");
- stringBuilder.append(Version.getVersion()).append(" OpenSAML/").append(org.opensaml.core.Version.getVersion());
- setUserAgent(stringBuilder.toString());
- }
-
-}
\ No newline at end of file
diff --git a/idp-core/src/main/java/net/shibboleth/idp/http/InMemoryCachingHttpClientBuilder.java b/idp-core/src/main/java/net/shibboleth/idp/http/InMemoryCachingHttpClientBuilder.java
deleted file mode 100644
index b4320c9..0000000
--- a/idp-core/src/main/java/net/shibboleth/idp/http/InMemoryCachingHttpClientBuilder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.http;
-
-import net.shibboleth.idp.Version;
-
-/**
- * InMemoryCachingHttpClientBuilder customization for the Shibboleth IdP.
- */
-public class InMemoryCachingHttpClientBuilder
- extends net.shibboleth.utilities.java.support.httpclient.InMemoryCachingHttpClientBuilder {
-
- /**
- * Constructor.
- */
- public InMemoryCachingHttpClientBuilder() {
- final StringBuilder stringBuilder = new StringBuilder("ShibbolethIdp/");
- stringBuilder.append(Version.getVersion()).append(" OpenSAML/").append(org.opensaml.core.Version.getVersion());
- setUserAgent(stringBuilder.toString());
- }
-
-}
\ No newline at end of file
diff --git a/idp-core/src/main/java/net/shibboleth/idp/http/package-info.java b/idp-core/src/main/java/net/shibboleth/idp/http/package-info.java
deleted file mode 100644
index 7a0d24d..0000000
--- a/idp-core/src/main/java/net/shibboleth/idp/http/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * HTTP-related classes.
- */
-
-package net.shibboleth.idp.http;
\ No newline at end of file
diff --git a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java
index 90eee3c..28b8fc9 100644
--- a/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java
+++ b/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/AbstractMetadataParserTest.java
@@ -43,6 +43,7 @@ import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import net.shibboleth.ext.spring.config.DurationToLongConverter;
+import net.shibboleth.ext.spring.config.StringToDurationConverter;
import net.shibboleth.ext.spring.config.StringToIPRangeConverter;
import net.shibboleth.ext.spring.config.StringToResourceConverter;
import net.shibboleth.ext.spring.context.FilesystemGenericApplicationContext;
@@ -159,6 +160,7 @@ public class AbstractMetadataParserTest extends OpenSAMLInitBaseTestCase {
context.setDisplayName("ApplicationContext: " + contextName);
service.setConverters(new HashSet<>(Arrays.asList(
new DurationToLongConverter(),
+ new StringToDurationConverter(),
new StringToIPRangeConverter(),
new StringToResourceConverter())));
service.afterPropertiesSet();
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/parent.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/parent.xml
index a81c83d..e81584a 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/parent.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/parent.xml
@@ -25,6 +25,7 @@
<bean class="net.shibboleth.ext.spring.config.BooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringBooleanToPredicateConverter" />
<bean class="net.shibboleth.ext.spring.config.StringToResourceConverter" />
+ <bean class="net.shibboleth.ext.spring.config.StringToDurationConverter" />
</set>
</property>
</bean>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list