[java-identity-provider] 06/11: IDP-1464 Extend UI Node Processor to handle ACS

Rod Widdowson rdw at steadingsoftware.com
Tue Jun 11 09:38:24 EDT 2019


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=f43dd4c3ab13f97819a6a10267638b3ff4323621

commit f43dd4c3ab13f97819a6a10267638b3ff4323621
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jun 10 14:59:19 2019 +0100

    IDP-1464 Extend UI Node Processor to handle ACS
    
    https://issues.shibboleth.net/jira/browse/IDP-1464
    
    plus tests
---
 .../saml/metadata/impl/UIInfoNodeProcessor.java    | 11 ++++++++---
 .../metadata/impl/UIInfoNodeProcessorTest.java     | 22 +++++++++++++++++++++-
 .../saml/impl/metadata/NodeProcessor-metadata.xml  | 12 +++++++++++-
 3 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessor.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessor.java
index 3a4ead1..c87f542 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessor.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessor.java
@@ -23,21 +23,26 @@ import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.ext.saml2mdui.UIInfo;
 import org.opensaml.saml.metadata.resolver.filter.FilterException;
 import org.opensaml.saml.metadata.resolver.filter.MetadataNodeProcessor;
+import org.opensaml.saml.saml2.metadata.AttributeConsumingService;
 
+import net.shibboleth.idp.saml.metadata.ACSUIInfo;
 import net.shibboleth.idp.saml.metadata.IdPUIInfo;
 
 /**
- * An implementation of {@link MetadataNodeProcessor} which processes any {@link UIInfo}s from any
- * and processes them into an {@link IdPUIInfo}.
+ * An implementation of {@link MetadataNodeProcessor} which processes any {@link UIInfo}s 
+ * into an {@link IdPUIInfo} and processes any {@link AttributeConsumingService} into an
+ * {@link ACSUIInfo}.
  */
 @NotThreadSafe
 public class UIInfoNodeProcessor implements MetadataNodeProcessor {
   
     /** {@inheritDoc} */
     @Override public void process(final XMLObject metadataNode) throws FilterException {
-        
+
         if (metadataNode instanceof UIInfo) {
             metadataNode.getObjectMetadata().put(new IdPUIInfo((UIInfo) metadataNode));
+        } else if (metadataNode instanceof AttributeConsumingService) {
+            metadataNode.getObjectMetadata().put(new ACSUIInfo((AttributeConsumingService)metadataNode));
         }
     }
 
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessorTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessorTest.java
index b89e1b5..792a22e 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessorTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/UIInfoNodeProcessorTest.java
@@ -25,10 +25,12 @@ import org.opensaml.core.criterion.EntityIdCriterion;
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.saml.ext.saml2mdui.UIInfo;
 import org.opensaml.saml.metadata.resolver.filter.MetadataNodeProcessor;
+import org.opensaml.saml.saml2.metadata.AssertionConsumerService;
 import org.opensaml.saml.saml2.metadata.EntityDescriptor;
 import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
 import org.testng.annotations.Test;
 
+import net.shibboleth.idp.saml.metadata.ACSUIInfo;
 import net.shibboleth.idp.saml.metadata.IdPUIInfo;
 import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import net.shibboleth.utilities.java.support.resolver.ResolverException;
@@ -36,7 +38,7 @@ import net.shibboleth.utilities.java.support.resolver.ResolverException;
 public final class UIInfoNodeProcessorTest extends BaseNodeProcessorTest {
     
     @Test 
-    public void test() throws ResolverException {
+    public void idPUIInfoTest() throws ResolverException {
         final EntityDescriptor entity  = resolver.resolveSingle(new CriteriaSet(new EntityIdCriterion("https://scopes.example.org")));
 
         final IDPSSODescriptor idpSSO = entity.getIDPSSODescriptor("urn:oasis:names:tc:SAML:2.0:protocol");
@@ -56,6 +58,24 @@ public final class UIInfoNodeProcessorTest extends BaseNodeProcessorTest {
         assertEquals(uiInfo.getLocaleLogos().get(l).size(), 1);
         assertEquals(uiInfo.getNonLocaleLogos().size(), 2);
     }
+    
+    
+    public void acsUIInfoTest() throws ResolverException {
+        final EntityDescriptor entity  = resolver.resolveSingle(new CriteriaSet(new EntityIdCriterion("https://sp.example.org")));
+
+        final AssertionConsumerService acs = entity.
+                getSPSSODescriptor("urn:oasis:names:tc:SAML:2.0:protocol").
+                getAssertionConsumerServices().
+                get(0);
+       
+        final ACSUIInfo uiInfo = acs.getObjectMetadata().get(ACSUIInfo.class).get(0);
+        
+        
+        final Locale l = Locale.forLanguageTag("en");
+        assertEquals(uiInfo.getServiceNames().get(l), "ServiceName");
+        assertEquals(uiInfo.getServiceDescriptions().get(l), "ServiceDesc");
+    }
+
 
     /** {@inheritDoc} */
     protected MetadataNodeProcessor getProcessor() {
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/NodeProcessor-metadata.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/NodeProcessor-metadata.xml
index dc1791d..7bf81df 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/NodeProcessor-metadata.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/NodeProcessor-metadata.xml
@@ -45,5 +45,15 @@ urn:oasis:names:tc:SAML:metadata:ui http://docs.oasis-open.org/security/saml/Pos
                 <shibmd:Scope regexp="true">^.*AASCOPE2.*</shibmd:Scope>
             </Extensions>
         </AttributeAuthorityDescriptor>
-    </EntityDescriptor>   
+    </EntityDescriptor> 
+    
+    <EntityDescriptor entityID="https:sp.example.org">
+    	<SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+	    	<AttributeConsumingService index="1">
+			    <ServiceName xml:lang="fr">Nom D'un Chien</ServiceName>
+			    <ServiceName xml:lang="en">ServiceName</ServiceName>
+			    <ServiceDescription xml:lang="de">ServiceDesc</ServiceDescription>
+			</AttributeConsumingService>
+    	</SPSSODescriptor>
+    </EntityDescriptor>  
 </EntitiesDescriptor>

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


More information about the commits mailing list