[java-identity-provider] branch master updated: IDP-1434 - Redesign Attribute encoding/decoding as a service

Scott Cantor cantor.2 at osu.edu
Thu May 16 16:25:46 EDT 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=0ae966540fca09af0d0ccd8826a81a4933b8680b

The following commit(s) were added to refs/heads/master by this push:
       new  0ae9665   IDP-1434 - Redesign Attribute encoding/decoding as a service
0ae9665 is described below

commit 0ae966540fca09af0d0ccd8826a81a4933b8680b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 16 16:25:04 2019 -0400

    IDP-1434 - Redesign Attribute encoding/decoding as a service
    
    https://issues.shibboleth.net/jira/browse/IDP-1434
    
    Some class and property reorganization.
    Working on unit test for extended EntityAttributesPredicate.
---
 .../transcoding/AttributeTranscoderRegistry.java   |   2 +-
 .../impl/AttributeRegistryServiceStrategy.java     |   4 +-
 .../impl/AttributeTranscoderRegistryImpl.java      |   2 +-
 .../spring/AttributeMappingNodeProcessorTest.java  |   1 -
 .../idp/attribute/resolver/filter/service.xml      |   2 +-
 .../idp/attribute/resolver/spring/mapperTest.xml   |   2 +-
 .../attributes/saml1/eduPersonPrincipalName.txt    |   2 +-
 .../saml1/eduPersonScopedAffiliation.txt           |   2 +-
 .../src/main/resources/attributes/saml1/mail.txt   |   2 +-
 .../src/main/resources/attributes/saml1/uid.txt    |   2 +-
 .../attributes/saml2/eduPersonPrincipalName.txt    |   2 +-
 .../saml2/eduPersonScopedAffiliation.txt           |   2 +-
 .../src/main/resources/attributes/saml2/mail.txt   |   2 +-
 .../src/main/resources/attributes/saml2/uid.txt    |   2 +-
 .../main/resources/system/conf/services-system.xml |   2 +-
 .../impl/EntityAttributesPredicateTest.java        | 144 +++++++++++++++++++++
 .../impl/metadata/attribute-mapping-metadata.xml   |  58 +++++++++
 .../impl/metadata/attribute-registry-service.xml   |  29 +++++
 .../idp/saml/impl/metadata/attribute-registry.xml  |  34 +++++
 .../shibboleth/idp/saml/impl/metadata/rules/rs.txt |   3 +
 .../idp/saml/impl/metadata/rules/subjectid.txt     |   3 +
 .../idp/saml/impl/metadata/rules/zorkmids.txt      |   4 +
 22 files changed, 289 insertions(+), 17 deletions(-)

diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/transcoding/AttributeTranscoderRegistry.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/transcoding/AttributeTranscoderRegistry.java
index 2594818..13a3ddb 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/transcoding/AttributeTranscoderRegistry.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/transcoding/AttributeTranscoderRegistry.java
@@ -44,7 +44,7 @@ public interface AttributeTranscoderRegistry extends IdentifiedComponent {
     @Nonnull @NotEmpty static final String PROP_TRANSCODER = "transcoder";
 
     /** Property name for identifying an {@link AttributeTranscoder} class to build. */
-    @Nonnull @NotEmpty static final String PROP_TRANSCODER_CLASS = "transcoder_class";
+    @Nonnull @NotEmpty static final String PROP_TRANSCODER_CLASS = "transcoderClass";
     
     /** Property name for accessing an activation condition object to apply. */
     @Nonnull @NotEmpty static final String PROP_CONDITION = "activationCondition";
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/transcoding/spring/impl/AttributeRegistryServiceStrategy.java b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
similarity index 95%
rename from idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/transcoding/spring/impl/AttributeRegistryServiceStrategy.java
rename to idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
index c290c23..8a65b8c 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/transcoding/spring/impl/AttributeRegistryServiceStrategy.java
+++ b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeRegistryServiceStrategy.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.idp.attribute.transcoding.spring.impl;
+package net.shibboleth.idp.attribute.transcoding.impl;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -31,8 +31,6 @@ import org.springframework.context.ApplicationContext;
 
 import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
 import net.shibboleth.idp.attribute.transcoding.TranscodingRule;
-import net.shibboleth.idp.attribute.transcoding.impl.AttributeTranscoderRegistryImpl;
-import net.shibboleth.idp.attribute.transcoding.impl.TranscodingRuleLoader;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
diff --git a/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
index 24262d3..937c6b4 100644
--- a/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
+++ b/idp-attribute-impl/src/main/java/net/shibboleth/idp/attribute/transcoding/impl/AttributeTranscoderRegistryImpl.java
@@ -59,7 +59,7 @@ public class AttributeTranscoderRegistryImpl extends AbstractServiceableComponen
         implements AttributeTranscoderRegistry {
 
     /** Bean name for identifying an {@link AttributeTranscoder} object to install. */
-    @Nonnull @NotEmpty static final String PROP_TRANSCODER_BEAN = "transcoder_bean";
+    @Nonnull @NotEmpty static final String PROP_TRANSCODER_BEAN = "transcoderBean";
     
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(AttributeTranscoderRegistryImpl.class);
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeMappingNodeProcessorTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeMappingNodeProcessorTest.java
index 1f1c004..d35e2df 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeMappingNodeProcessorTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeMappingNodeProcessorTest.java
@@ -85,7 +85,6 @@ public class AttributeMappingNodeProcessorTest extends XMLObjectBaseTestCase {
         context.setDisplayName("ApplicationContext: ");
 
         final ConversionServiceFactoryBean service = new ConversionServiceFactoryBean();
-        context.setDisplayName("ApplicationContext: ");
         service.setConverters(new HashSet<>(Arrays.asList(new StringToDurationConverter())));
         service.afterPropertiesSet();
 
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/filter/service.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/filter/service.xml
index 957ac48..4e83d40 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/filter/service.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/filter/service.xml
@@ -13,7 +13,7 @@
 		<constructor-arg name="claz"
 			value="net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry" />
 		<constructor-arg name="strategy">
-			<bean class="net.shibboleth.idp.attribute.transcoding.spring.impl.AttributeRegistryServiceStrategy"
+			<bean class="net.shibboleth.idp.attribute.transcoding.impl.AttributeRegistryServiceStrategy"
 				p:id="shibboleth.AttributeRegistryService"
 				p:namingRegistry="DefaultNamingRegistry" />
 		</constructor-arg>
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/mapperTest.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/mapperTest.xml
index b86d5a7..4e61be0 100644
--- a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/mapperTest.xml
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/mapperTest.xml
@@ -32,7 +32,7 @@
         <constructor-arg name="claz"
             value="net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry" />
         <constructor-arg name="strategy">
-            <bean class="net.shibboleth.idp.attribute.transcoding.spring.impl.AttributeRegistryServiceStrategy"
+            <bean class="net.shibboleth.idp.attribute.transcoding.impl.AttributeRegistryServiceStrategy"
                 p:id="shibboleth.AttributeRegistryService"
                 p:namingRegistry="DefaultNamingRegistry" />
         </constructor-arg>
diff --git a/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt b/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt
index 008831d..74ff33e 100644
--- a/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt
+++ b/idp-conf/src/main/resources/attributes/saml1/eduPersonPrincipalName.txt
@@ -1,4 +1,4 @@
 id = eduPersonPrincipalName
-transcoder_bean = SAML1ScopedStringTranscoder
+transcoderBean = SAML1ScopedStringTranscoder
 name = urn:mace:dir:attribute-def:eduPersonPrincipalName
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt b/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt
index e6c505b..46fe82d 100644
--- a/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt
+++ b/idp-conf/src/main/resources/attributes/saml1/eduPersonScopedAffiliation.txt
@@ -1,4 +1,4 @@
 id = eduPersonScopedAffiliation
-transcoder_bean = SAML1ScopedStringTranscoder
+transcoderBean = SAML1ScopedStringTranscoder
 name = urn:mace:dir:attribute-def:eduPersonScopedAffiliation
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/mail.txt b/idp-conf/src/main/resources/attributes/saml1/mail.txt
index 22f4da9..d406301 100644
--- a/idp-conf/src/main/resources/attributes/saml1/mail.txt
+++ b/idp-conf/src/main/resources/attributes/saml1/mail.txt
@@ -1,4 +1,4 @@
 id = mail
-transcoder_bean = SAML1StringTranscoder
+transcoderBean = SAML1StringTranscoder
 name = urn:mace:dir:attribute-def:mail
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml1/uid.txt b/idp-conf/src/main/resources/attributes/saml1/uid.txt
index 209d6a0..bf6272e 100644
--- a/idp-conf/src/main/resources/attributes/saml1/uid.txt
+++ b/idp-conf/src/main/resources/attributes/saml1/uid.txt
@@ -1,4 +1,4 @@
 id = uid
-transcoder_bean = SAML1StringTranscoder
+transcoderBean = SAML1StringTranscoder
 name = urn:mace:dir:attribute-def:uid
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt b/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt
index 970f0da..8c1022e 100644
--- a/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt
+++ b/idp-conf/src/main/resources/attributes/saml2/eduPersonPrincipalName.txt
@@ -1,4 +1,4 @@
 id = eduPersonPrincipalName
-transcoder_bean = SAML2ScopedStringTranscoder
+transcoderBean = SAML2ScopedStringTranscoder
 name = urn:oid:1.3.6.1.4.1.5923.1.1.1.6
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt b/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt
index aedfcb5..d0e73e9 100644
--- a/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt
+++ b/idp-conf/src/main/resources/attributes/saml2/eduPersonScopedAffiliation.txt
@@ -1,4 +1,4 @@
 id = eduPersonScopedAffiliation
-transcoder_bean = SAML2ScopedStringTranscoder
+transcoderBean = SAML2ScopedStringTranscoder
 name = urn:oid:1.3.6.1.4.1.5923.1.1.1.9
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/mail.txt b/idp-conf/src/main/resources/attributes/saml2/mail.txt
index 8e28190..8239f7d 100644
--- a/idp-conf/src/main/resources/attributes/saml2/mail.txt
+++ b/idp-conf/src/main/resources/attributes/saml2/mail.txt
@@ -1,4 +1,4 @@
 id = mail
-transcoder_bean = SAML2StringTranscoder
+transcoderBean = SAML2StringTranscoder
 name = urn:oid:0.9.2342.19200300.100.1.3
 encodeType = false
diff --git a/idp-conf/src/main/resources/attributes/saml2/uid.txt b/idp-conf/src/main/resources/attributes/saml2/uid.txt
index 0f259a9..1e60e72 100644
--- a/idp-conf/src/main/resources/attributes/saml2/uid.txt
+++ b/idp-conf/src/main/resources/attributes/saml2/uid.txt
@@ -1,4 +1,4 @@
 id = uid
-transcoder_bean = SAML2StringTranscoder
+transcoderBean = SAML2StringTranscoder
 name = urn:oid:0.9.2342.19200300.100.1.1
 encodeType = false
diff --git a/idp-conf/src/main/resources/system/conf/services-system.xml b/idp-conf/src/main/resources/system/conf/services-system.xml
index 8062fdc..aff83bf 100644
--- a/idp-conf/src/main/resources/system/conf/services-system.xml
+++ b/idp-conf/src/main/resources/system/conf/services-system.xml
@@ -65,7 +65,7 @@
 	        p:beanFactoryPostProcessors-ref="shibboleth.PropertySourcesPlaceholderConfigurer">
 	    <constructor-arg name="claz" value="net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry" />
 	    <constructor-arg name="strategy">
-	       <bean class="net.shibboleth.idp.attribute.transcoding.spring.impl.AttributeRegistryServiceStrategy"
+	       <bean class="net.shibboleth.idp.attribute.transcoding.impl.AttributeRegistryServiceStrategy"
 	           p:namingRegistry="#{'%{idp.service.attribute.registry.namingRegistry:DefaultNamingRegistry}'.trim()}" />
 	    </constructor-arg>
     </bean>
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/EntityAttributesPredicateTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/EntityAttributesPredicateTest.java
new file mode 100644
index 0000000..7d9168a
--- /dev/null
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/metadata/impl/EntityAttributesPredicateTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.saml.metadata.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.opensaml.core.criterion.EntityIdCriterion;
+import org.opensaml.core.xml.XMLObjectBaseTestCase;
+import org.opensaml.saml.common.profile.logic.EntityAttributesPredicate.Candidate;
+import org.opensaml.saml.metadata.resolver.MetadataResolver;
+import org.opensaml.saml.metadata.resolver.filter.MetadataNodeProcessor;
+import org.opensaml.saml.metadata.resolver.filter.impl.NodeProcessingMetadataFilter;
+import org.opensaml.saml.metadata.resolver.impl.DOMMetadataResolver;
+import org.opensaml.saml.saml2.core.Attribute;
+import org.opensaml.saml.saml2.metadata.EntityDescriptor;
+import org.springframework.context.support.ConversionServiceFactoryBean;
+import org.springframework.context.support.GenericApplicationContext;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+import junit.framework.Assert;
+import net.shibboleth.ext.spring.config.StringToDurationConverter;
+import net.shibboleth.ext.spring.util.SchemaTypeAwareXMLBeanDefinitionReader;
+import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
+import net.shibboleth.idp.saml.profile.logic.EntityAttributesPredicate;
+import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
+import net.shibboleth.utilities.java.support.resolver.ResolverException;
+import net.shibboleth.utilities.java.support.service.ReloadableService;
+
+/**
+ * Unit test for {@link EntityAttributesPredicate}.
+ */
+public class EntityAttributesPredicateTest extends XMLObjectBaseTestCase {
+    
+    private String fooEntityID = "http://foo.example.org/shibboleth";
+    
+    private String barEntityID = "http://bar.example.org/shibboleth";
+    
+    private GenericApplicationContext pendingTeardownContext = null;
+    
+    private MetadataResolver resolver = null;
+    
+    @BeforeClass
+    protected void setUp() throws Exception {
+        String mdFileName = "/net/shibboleth/idp/saml/impl/metadata/attribute-mapping-metadata.xml";
+        
+        final Document mdDoc = parserPool.parse(getClass().getResourceAsStream(mdFileName));
+        final DOMMetadataResolver mdProvider = new DOMMetadataResolver(mdDoc.getDocumentElement());
+        
+        List<MetadataNodeProcessor> processors = new ArrayList<>();
+        processors.add(new AttributeMappingNodeProcessor(getService()));
+        
+        final NodeProcessingMetadataFilter nodeFilter =  new NodeProcessingMetadataFilter();
+        nodeFilter.setNodeProcessors(processors);
+        nodeFilter.initialize();
+        
+        mdProvider.setMetadataFilter(nodeFilter);
+        mdProvider.setId("Test");
+        mdProvider.initialize();
+
+        resolver = mdProvider;
+    }
+    
+    @AfterClass public void tearDownTestContext() {
+        if (null == pendingTeardownContext ) {
+            return;
+        }
+        pendingTeardownContext.close();
+        pendingTeardownContext = null;
+    }
+    
+    private void setTestContext(GenericApplicationContext context) {
+        tearDownTestContext();
+        pendingTeardownContext = context;
+    }
+    
+    private EntityDescriptor getEntity(final String entityID) throws ResolverException {
+        return resolver.resolveSingle(new CriteriaSet(new EntityIdCriterion(entityID)));
+    }
+    
+    private ReloadableService<AttributeTranscoderRegistry> getService() {
+        GenericApplicationContext context = new GenericApplicationContext();
+        setTestContext(context);
+        context.setDisplayName("ApplicationContext: ");
+
+        final ConversionServiceFactoryBean service = new ConversionServiceFactoryBean();
+        service.setConverters(new HashSet<>(Arrays.asList(new StringToDurationConverter())));
+        service.afterPropertiesSet();
+
+        context.getBeanFactory().setConversionService(service.getObject());
+        
+        SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+                new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+        beanDefinitionReader.loadBeanDefinitions("/net/shibboleth/idp/saml/impl/metadata/attribute-registry-service.xml");
+        context.refresh();
+
+        return context.getBean(ReloadableService.class);
+    }
+
+    @Test
+    public void testSimpleMatchSAML() throws ResolverException {
+        
+        final Candidate tag = new Candidate("zorkmids", Attribute.BASIC);
+        tag.setValues(Collections.singletonList("10"));
+        
+        final EntityAttributesPredicate predicate = new EntityAttributesPredicate(Collections.singletonList(tag));
+        Assert.assertFalse(predicate.test(getEntity(fooEntityID)));
+        Assert.assertTrue(predicate.test(getEntity(barEntityID)));
+    }
+    
+    @Test
+    public void testSimpleMatchMapped() throws ResolverException {
+        
+        final Candidate tag = new Candidate("zorkmids");
+        tag.setValues(Collections.singletonList("10"));
+        
+        final EntityAttributesPredicate predicate = new EntityAttributesPredicate(Collections.singletonList(tag));
+        Assert.assertFalse(predicate.test(getEntity(fooEntityID)));
+        Assert.assertTrue(predicate.test(getEntity(barEntityID)));
+    }
+
+}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-mapping-metadata.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-mapping-metadata.xml
new file mode 100644
index 0000000..6a5077a
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-mapping-metadata.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<EntitiesDescriptor Name="example.org"
+    xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
+    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+    xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute">
+   
+   <EntityDescriptor entityID="http://foo.example.org/shibboleth">
+      
+      <Extensions>
+        <mdattr:EntityAttributes>
+            <saml:Attribute Name="http://macedir.org/entity-category"
+                NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
+                <saml:AttributeValue>http://refeds.org/category/research-and-scholarship</saml:AttributeValue>
+            </saml:Attribute>
+            <saml:Attribute Name="urn:oasis:names:tc:SAML:profiles:subject-id:req"
+                NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
+                <saml:AttributeValue>none</saml:AttributeValue>
+            </saml:Attribute>
+        </mdattr:EntityAttributes>
+      </Extensions>
+      
+      <IDPSSODescriptor protocolSupportEnumeration="foo">
+         <SingleSignOnService Binding="urn:mace:shibboleth:1.0:profiles:AuthnRequest" Location="https://foo.example.org/shibboleth/SSO_BAR"/>
+      </IDPSSODescriptor>
+      
+   </EntityDescriptor>
+   
+
+   <EntityDescriptor entityID="http://bar.example.org/shibboleth">
+
+      <Extensions>
+        <mdattr:EntityAttributes>
+            <saml:Attribute Name="zorkmids"
+                NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+                <saml:AttributeValue>10</saml:AttributeValue>
+            </saml:Attribute>
+            <saml:Attribute Name="babelfish"
+                NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
+                <saml:AttributeValue>10</saml:AttributeValue>
+            </saml:Attribute>
+        </mdattr:EntityAttributes>
+      </Extensions>
+      
+      <SPSSODescriptor protocolSupportEnumeration="foo">
+         <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="https://bar.example.org/Shibboleth.sso/POST" index="0"/>
+      </SPSSODescriptor>
+      
+   </EntityDescriptor>
+
+   <EntityDescriptor entityID="http://baz.example.org/shibboleth">
+
+      <SPSSODescriptor protocolSupportEnumeration="foo">
+         <AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="https://baz.example.org/Shibboleth.sso/POST" index="0"/>
+      </SPSSODescriptor>
+      
+   </EntityDescriptor>
+
+</EntitiesDescriptor>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry-service.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry-service.xml
new file mode 100644
index 0000000..271cd9a
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry-service.xml
@@ -0,0 +1,29 @@
+<?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:util="http://www.springframework.org/schema/util"
+        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.xsd
+                            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+        default-init-method="initialize"
+        default-destroy-method="destroy">
+        
+    <bean id="shibboleth.AttributeRegistryService" class="net.shibboleth.ext.spring.service.ReloadableSpringService" p:failFast="true"
+        p:reloadCheckDelay="0">
+
+        <constructor-arg name="claz"
+            value="net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry" />
+        <constructor-arg name="strategy">
+            <bean class="net.shibboleth.idp.attribute.transcoding.impl.AttributeRegistryServiceStrategy"
+                p:id="shibboleth.AttributeRegistryService"
+                p:namingRegistry="DefaultNamingRegistry" />
+        </constructor-arg>
+        <property name="serviceConfigurations">
+            <util:list>
+                <value>net/shibboleth/idp/saml/impl/metadata/attribute-registry.xml</value>
+            </util:list>
+        </property>
+    </bean>
+
+</beans>
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry.xml
new file mode 100644
index 0000000..c71cafc
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/attribute-registry.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:c="http://www.springframework.org/schema/c"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+                           
+       default-init-method="initialize"
+       default-destroy-method="destroy">
+
+    <bean id="SAML2StringTranscoder"
+        class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2StringAttributeTranscoder" />
+    <bean id="SAML2ScopedStringTranscoder"
+        class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2ScopedStringAttributeTranscoder" />
+    <bean id="SAML2ByteTranscoder"
+        class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2ByteAttributeTranscoder" />
+    <bean id="SAML2XMLObjectTranscoder"
+        class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2XMLObjectAttributeTranscoder" />
+
+    <util:map id="DefaultNamingRegistry">
+        <entry key="#{T(org.opensaml.saml.saml2.core.Attribute)}">
+            <bean class="net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML2AttributeTranscoder.NamingFunction" />
+        </entry>
+    </util:map>
+        
+    <bean id="shibboleth.TranscodingRuleLoader"
+        class="net.shibboleth.idp.attribute.transcoding.impl.TranscodingRuleLoader"
+        c:dir="net/shibboleth/idp/saml/impl/metadata/rules" />
+    
+</beans>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/rs.txt b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/rs.txt
new file mode 100644
index 0000000..12d0bc8
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/rs.txt
@@ -0,0 +1,3 @@
+id = rands
+transcoderBean = SAML2StringTranscoder
+name = http://macedir.org/entity-category
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/subjectid.txt b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/subjectid.txt
new file mode 100644
index 0000000..2ec37fc
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/subjectid.txt
@@ -0,0 +1,3 @@
+id = subject-id-req
+transcoderBean = SAML2StringTranscoder
+name = urn:oasis:names:tc:SAML:profiles:subject-id:req
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/zorkmids.txt b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/zorkmids.txt
new file mode 100644
index 0000000..fec7321
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/metadata/rules/zorkmids.txt
@@ -0,0 +1,4 @@
+id = zorkmids
+transcoderBean = SAML2StringTranscoder
+name = zorkmids
+nameFormat = urn:oasis:names:tc:SAML:2.0:attrname-format:basic

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


More information about the commits mailing list