[java-identity-provider] branch master updated: Add customObjectRef wiring to URL/BodyTemplate elements.

Scott Cantor cantor.2 at osu.edu
Wed Jan 3 19:37:19 EST 2018


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=3ffcbfda4e3afc67838a4afdad50a10a873a5eae

The following commit(s) were added to refs/heads/master by this push:
       new  3ffcbfd   Add customObjectRef wiring to URL/BodyTemplate elements.
3ffcbfd is described below

commit 3ffcbfda4e3afc67838a4afdad50a10a873a5eae
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 3 19:37:17 2018 -0500

    Add customObjectRef wiring to URL/BodyTemplate elements.
---
 .../dc/http/impl/HTTPDataConnectorParser.java      | 23 ++++++++++++++++++++--
 .../dc/http/http-attribute-resolver-v2-body.xml    |  4 ++--
 .../spring/dc/http/http-attribute-resolver-v2.xml  |  2 +-
 .../resolver/spring/dc/http/spring-beans.xml       |  3 +++
 .../schema/shibboleth-attribute-resolver.xsd       | 10 +++++++++-
 5 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
index 6ff04a8..87066f2 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/http/impl/HTTPDataConnectorParser.java
@@ -227,6 +227,12 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
                 url = urlTemplates.get(0).getTextContent();
             }
             templateBuilder.addPropertyValue("templateText", url);
+
+            final String customRef =
+                    StringSupport.trimOrNull(urlTemplates.get(0).getAttributeNS(null, "customObjectRef"));
+            if (null != customRef) {
+                templateBuilder.addPropertyReference("customObject", customRef);
+            }
             
             final String headerMapRef = StringSupport.trimOrNull(configElement.getAttributeNS(null, "headerMapRef"));
             if (headerMapRef != null) {
@@ -290,8 +296,22 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
                         getLogPrefix());
             }
             
-            templateBuilder.addPropertyValue("uRLTemplateText", urlTemplates.get(0).getTextContent());
+            final Element urlTemplate = urlTemplates.get(0);
             final Element bodyTemplate = bodyTemplates.get(0);
+            if (urlTemplate.hasAttributeNS(null, "customObjectRef")) {
+                templateBuilder.addPropertyReference("customObject",
+                        urlTemplate.getAttributeNS(null, "customObjectRef"));
+                if (bodyTemplate.hasAttributeNS(null, "customObjectRef")) {
+                    log.warn("{} Ignored <BodyTemplate> customObjectRef in favor of <URLTemplate> customObjectRef",
+                            getLogPrefix());
+                }
+            } else if (bodyTemplate.hasAttributeNS(null, "customObjectRef")) {
+                templateBuilder.addPropertyReference("customObject",
+                        bodyTemplate.getAttributeNS(null, "customObjectRef"));
+            }
+            
+            templateBuilder.addPropertyValue("uRLTemplateText", urlTemplate.getTextContent());
+            
             templateBuilder.addPropertyValue("bodyTemplateText", bodyTemplate.getTextContent());
             if (bodyTemplate.hasAttributeNS(null, "MIMEType")) {
                 templateBuilder.addPropertyValue("mIMEType", bodyTemplate.getAttributeNS(null, "MIMEType"));
@@ -302,7 +322,6 @@ public class HTTPDataConnectorParser extends AbstractDataConnectorParser {
             if (cacheKeyTemplates.size() > 0) {
                 templateBuilder.addPropertyValue("cacheKeyTemplateText", cacheKeyTemplates.get(0).getTextContent());
             }
-            
             final String headerMapRef = StringSupport.trimOrNull(configElement.getAttributeNS(null, "headerMapRef"));
             if (headerMapRef != null) {
                 templateBuilder.addPropertyReference("headers", headerMapRef);
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-body.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-body.xml
index 3d60179..c39324f 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-body.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/http/http-attribute-resolver-v2-body.xml
@@ -8,8 +8,8 @@
             acceptStatuses="200 201"
             acceptTypes="application/json">
             
-        <URLTemplate>%{serviceURL}</URLTemplate>
-        <BodyTemplate MIMEType="application/json">%{serviceBody}</BodyTemplate>
+        <URLTemplate customObjectRef="CustomObject">%{serviceURL}</URLTemplate>
+        <BodyTemplate MIMEType="application/json" customObjectRef="CustomObject">%{serviceBody}</BodyTemplate>
         
         <ResponseMapping>
             <ScriptFile>%{scriptPath}</ScriptFile>
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 aef5052..cb012c9 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
@@ -8,7 +8,7 @@
             acceptStatuses="200 201"
             acceptTypes="application/json">
             
-        <URLTemplate>%{serviceURL}</URLTemplate>
+        <URLTemplate customObjectRef="CustomObject">%{serviceURL}</URLTemplate>
         
         <ResponseMapping>
             <ScriptFile>%{scriptPath}</ScriptFile>
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 96e995c..7342e5f 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
@@ -1,10 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:c="http://www.springframework.org/schema/c"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"
     default-init-method="initialize"
     default-destroy-method="destroy">
 
+    <bean id="CustomObject" class="java.lang.String" c:_0="foo" />
+
     <bean id="NoTrustEngineHttpClient"
         class="net.shibboleth.idp.profile.spring.relyingparty.metadata.HttpClientFactoryBean" />
 
diff --git a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
index 8b0f923..175a141 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-attribute-resolver.xsd
@@ -1264,12 +1264,19 @@
                     <element ref="resolver:InputAttributeDefinition"/>
                     <element ref="resolver:InputDataConnector"/>                                        
                     <element ref="resolver:FailoverDataConnector"/>
-                    <element name="URLTemplate" type="string">
+                    <element name="URLTemplate">
                         <annotation>
                             <documentation>
                                 A template that will be used to create the absolute URL to request.
                             </documentation>
                         </annotation>
+                        <complexType>
+                            <simpleContent>
+                                <extension base="string">
+                                    <attribute name="customObjectRef" type="string" />
+                                </extension>
+                            </simpleContent>
+                        </complexType>
                     </element>
                     <element name="BodyTemplate">
                         <annotation>
@@ -1282,6 +1289,7 @@
                                 <extension base="string">
                                     <attribute name="MIMEType" type="string" />
                                     <attribute name="charset" type="string" />
+					                <attribute name="customObjectRef" type="string" />
                                 </extension>
                             </simpleContent>
                         </complexType>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list