[java-identity-provider] 23/27: Converted SAML 1 query action to registry, fixed up unit test.
Scott Cantor
cantor.2 at osu.edu
Fri May 3 14:32:13 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch feature/IDP-1434
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=f37714d55208bda211b874508d8fb92168d64b80
commit f37714d55208bda211b874508d8fb92168d64b80
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 2 13:00:08 2019 -0400
Converted SAML 1 query action to registry, fixed up unit test.
---
.../impl/FilterByQueriedAttributeDesignators.java | 119 ++++++++++++++++---
.../FilterByQueriedAttributeDesignatorsTest.java | 90 +++++++++++---
.../idp/saml/impl/profile/AttributeQuery.xml | 4 +
.../idp/saml/impl/profile/AttributeQuerySaml1.xml | 24 ++--
.../impl/profile/UnmappedAttributeQuerySaml1.xml | 14 +++
.../idp/saml/impl/profile/saml1Mapper.xml | 131 ++++++++++-----------
6 files changed, 263 insertions(+), 119 deletions(-)
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
index d6bba98..8c6c388 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignators.java
@@ -19,6 +19,9 @@ package net.shibboleth.idp.saml.saml1.profile.impl;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nonnull;
@@ -26,6 +29,8 @@ import javax.annotation.Nullable;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.messaging.context.navigate.MessageLookup;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.InboundMessageContextLookup;
import org.opensaml.saml.saml1.core.AttributeDesignator;
@@ -34,15 +39,22 @@ import org.opensaml.saml.saml1.core.Request;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.collect.Multimap;
-
+import net.shibboleth.idp.attribute.AttributeDecodingException;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.context.AttributeContext;
+import net.shibboleth.idp.attribute.transcoding.AttributeTranscoder;
+import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
+import net.shibboleth.idp.attribute.transcoding.TranscoderSupport;
import net.shibboleth.idp.profile.AbstractProfileAction;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
-import net.shibboleth.idp.saml.attribute.mapping.AttributesMapper;
+import net.shibboleth.utilities.java.support.annotation.constraint.Live;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.service.ReloadableService;
+import net.shibboleth.utilities.java.support.service.ServiceableComponent;
/**
* Action that filters a set of attributes against the {@link org.opensaml.saml.saml1.core.AttributeDesignator}
@@ -55,9 +67,9 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(FilterByQueriedAttributeDesignators.class);
- /** Mapper used to get the engine used to filter attributes. */
- @Nonnull private final AttributesMapper<AttributeDesignator,IdPAttribute> map;
-
+ /** Transcoder registry service object. */
+ @NonnullAfterInit private ReloadableService<AttributeTranscoderRegistry> transcoderRegistry;
+
/** Strategy used to locate the {@link Request} containing the query to filter against. */
@Nonnull private Function<ProfileRequestContext,Request> requestLookupStrategy;
@@ -70,15 +82,8 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
/** AttributeContext to filter. */
@Nullable private AttributeContext attributeContext;
- /**
- * Constructor.
- *
- * @param mapper mapper used to consume designators
- */
- public FilterByQueriedAttributeDesignators(@Nonnull final
- AttributesMapper<AttributeDesignator,IdPAttribute> mapper) {
- map = Constraint.isNotNull(mapper, "Mapper cannot be null");
-
+ /** Constructor. */
+ public FilterByQueriedAttributeDesignators() {
attributeContextLookupStrategy = new ChildContextLookup<>(AttributeContext.class).compose(
new ChildContextLookup<>(RelyingPartyContext.class));
@@ -86,6 +91,17 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
}
/**
+ * Sets the registry of transcoding rules to apply to encode attributes.
+ *
+ * @param registry registry service interface
+ */
+ public void setTranscoderRegistry(@Nonnull final ReloadableService<AttributeTranscoderRegistry> registry) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ transcoderRegistry = Constraint.isNotNull(registry, "AttributeTranscoderRegistry cannot be null");
+ }
+
+ /**
* Set the strategy used to locate the {@link Request} associated with a given {@link ProfileRequestContext}.
*
* @param strategy lookup strategy
@@ -112,6 +128,16 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
/** {@inheritDoc} */
@Override
+ protected void doInitialize() throws ComponentInitializationException {
+ super.doInitialize();
+
+ if (transcoderRegistry == null) {
+ throw new ComponentInitializationException("AttributeTranscoderRegistry cannot be null");
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
if (!super.doPreExecute(profileRequestContext)) {
@@ -146,13 +172,38 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- final Collection<IdPAttribute> keepers = new ArrayList<>(query.getAttributeDesignators().size());
+ final Set<String> decodedAttributeIds = new HashSet<>();
+
+ ServiceableComponent<AttributeTranscoderRegistry> component = null;
+ try {
+ component = transcoderRegistry.getServiceableComponent();
+ if (component == null) {
+ log.error("Attribute transcoder service unavailable");
+ ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
+ return;
+ }
+
+ for (final AttributeDesignator designator : query.getAttributeDesignators()) {
+ decodeAttributeDesignator(component.getComponent(), profileRequestContext, designator,
+ decodedAttributeIds);
+ }
+
+ } catch (final AttributeDecodingException e) {
+ log.error("{} Error decoding AttributeDesignators, cannot process query", getLogPrefix(), e);
+ ActionSupport.buildEvent(profileRequestContext, EventIds.MESSAGE_PROC_ERROR);
+ return;
+ } finally {
+ if (component != null) {
+ component.unpinComponent();
+ }
+ }
+
- final Multimap<String,IdPAttribute> mapped = map.mapAttributes(query.getAttributeDesignators());
- log.debug("Query content mapped to attribute IDs: {}", mapped.keySet());
+ final Collection<IdPAttribute> keepers = new ArrayList<>(query.getAttributeDesignators().size());
+ log.debug("Query content mapped to attribute IDs: {}", decodedAttributeIds);
for (final IdPAttribute attribute : attributeContext.getIdPAttributes().values()) {
- if (mapped.containsKey(attribute.getId())) {
+ if (decodedAttributeIds.contains(attribute.getId())) {
log.debug("Retaining attribute '{}' requested by query", attribute.getId());
keepers.add(attribute);
} else {
@@ -163,4 +214,34 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
attributeContext.setIdPAttributes(keepers);
}
+ /**
+ * Access the registry of transcoding rules to decode the input {@link AttributeDesignator}.
+ *
+ * @param registry registry of transcoding rules
+ * @param profileRequestContext current profile request context
+ * @param input input object
+ * @param results collection to add attributeIDs to
+ *
+ * @throws AttributeDecodingException if an error occurs or no results were obtained
+ */
+ protected void decodeAttributeDesignator(@Nonnull final AttributeTranscoderRegistry registry,
+ @Nonnull final ProfileRequestContext profileRequestContext, @Nonnull final AttributeDesignator input,
+ @Nonnull @NonnullElements @Live final Collection<String> results)
+ throws AttributeDecodingException {
+
+ final Collection<Properties> transcodingRules = registry.getTranscodingProperties(input);
+ if (transcodingRules.isEmpty()) {
+ throw new AttributeDecodingException("AttributeDesignator '" + input.getAttributeName() +
+ "' does not have transcoding rules, cannot process query");
+ }
+
+ for (final Properties rules : transcodingRules) {
+ final AttributeTranscoder<AttributeDesignator> transcoder = TranscoderSupport.getTranscoder(rules);
+ final IdPAttribute decodedAttribute = transcoder.decode(profileRequestContext, input, rules);
+ if (decodedAttribute != null) {
+ results.add(decodedAttribute.getId());
+ }
+ }
+ }
+
}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
index 9c56761..6921679 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
@@ -22,11 +22,13 @@ import static org.testng.Assert.assertEquals;
import java.util.Collection;
import java.util.List;
+import javax.annotation.Nullable;
+
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.UnmarshallingException;
+import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.saml.saml1.core.AttributeDesignator;
-import org.opensaml.saml.saml1.core.AttributeQuery;
+import org.opensaml.saml.saml1.core.Request;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.webflow.execution.Event;
@@ -41,13 +43,16 @@ import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.ScopedStringAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.context.AttributeContext;
+import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
+import net.shibboleth.idp.attribute.transcoding.impl.AttributeTranscoderRegistryImpl;
import net.shibboleth.idp.profile.ActionTestingSupport;
import net.shibboleth.idp.profile.RequestContextBuilder;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-import net.shibboleth.idp.saml.attribute.mapping.AttributesMapper;
-import net.shibboleth.idp.saml.attribute.mapping.impl.SAML1AttributeDesignatorsMapper;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
+import net.shibboleth.utilities.java.support.service.ReloadableService;
+import net.shibboleth.utilities.java.support.service.ServiceableComponent;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
/** Tests for {@link FilterByQueriedAttributeDesignators} */
@@ -55,9 +60,9 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
static final String PATH = "/net/shibboleth/idp/saml/impl/profile/";
- private AttributeQuery query;
+ private Request query;
- private AttributesMapper<AttributeDesignator, IdPAttribute> mapper;
+ private ReloadableService<AttributeTranscoderRegistry> registry;
private FilterByQueriedAttributeDesignators action;
@@ -86,16 +91,19 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
}
}
- @BeforeClass public void setup() throws XMLParserException, UnmarshallingException {
- query = unmarshallElement(PATH + "AttributeQuerySaml1.xml", true);
- mapper = getBean(PATH + "saml1Mapper.xml", SAML1AttributeDesignatorsMapper.class);
+ @BeforeClass public void setup() {
+ registry = new RegistryService(getBean(PATH + "saml1Mapper.xml", AttributeTranscoderRegistryImpl.class));
}
- @BeforeMethod public void setUpMethod() throws ComponentInitializationException {
- action = new FilterByQueriedAttributeDesignators(mapper);
+ @BeforeMethod public void setUpMethod() throws ComponentInitializationException, XMLParserException, UnmarshallingException {
+ query = unmarshallElement(PATH + "AttributeQuerySaml1.xml", true);
+
+ action = new FilterByQueriedAttributeDesignators();
+ action.setTranscoderRegistry(registry);
+ action.initialize();
+
rc = new RequestContextBuilder().setInboundMessage(query).buildRequestContext();
prc = new WebflowRequestContextProfileRequestContextLookup().apply(rc);
- action.initialize();
}
@Test public void noAttributes() {
@@ -104,16 +112,39 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
ActionTestingSupport.assertProceedEvent(event);
}
+ @Test public void unmappedAttributes() throws XMLParserException, UnmarshallingException {
+ query = unmarshallElement(PATH + "UnmappedAttributeQuerySaml1.xml", true);
+
+ prc.getInboundMessageContext().setMessage(query);
+
+ final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
+ final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
+ final List<IdPAttribute> attributes = List.of(
+ new IdPAttribute("eduPersonAssurance"),
+ new IdPAttribute("flooby"),
+ new IdPAttribute("eduPersonScopedAffiliation"),
+ new IdPAttribute("eduPersonTargetedID"));
+ ac.setIdPAttributes(attributes);
+
+ final Event event = action.execute(rc);
+ ActionTestingSupport.assertEvent(event, EventIds.MESSAGE_PROC_ERROR);
+ }
+
@Test public void noValues() {
final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
- final List<IdPAttribute> attributes = List.of(new IdPAttribute("eduPersonAssurance"), new IdPAttribute("flooby"), new IdPAttribute("eduPersonScopedAffiliation"), new IdPAttribute("eduPersonTargetedID"));
+ final List<IdPAttribute> attributes = List.of(
+ new IdPAttribute("eduPersonAssurance"),
+ new IdPAttribute("flooby"),
+ new IdPAttribute("eduPersonScopedAffiliation"),
+ new IdPAttribute("eduPersonTargetedID"));
ac.setIdPAttributes(attributes);
final Event event = action.execute(rc);
ActionTestingSupport.assertProceedEvent(event);
- assertEquals(ac.getIdPAttributes().size(), 4);
+ assertEquals(ac.getIdPAttributes().size(), 3);
}
-
+
+ /** This is a non-issue for SAML 1, but just for completeness. */
@Test public void values() {
final RelyingPartyContext rpc = prc.getSubcontext(RelyingPartyContext.class,true);
final AttributeContext ac = rpc.getSubcontext(AttributeContext.class,true);
@@ -128,7 +159,32 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
ac.setIdPAttributes(attributes);
final Event event = action.execute(rc);
ActionTestingSupport.assertProceedEvent(event);
- assertEquals(ac.getIdPAttributes().size(), 4);
+ assertEquals(ac.getIdPAttributes().size(), 3);
+ }
+
+ private static class RegistryService extends AbstractReloadableService<AttributeTranscoderRegistry> {
+
+ private ServiceableComponent<AttributeTranscoderRegistry> component;
+
+ protected RegistryService(ServiceableComponent<AttributeTranscoderRegistry> what) {
+ component = what;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Nullable public ServiceableComponent<AttributeTranscoderRegistry> getServiceableComponent() {
+ if (null == component) {
+ return null;
+ }
+ component.pinComponent();
+ return component;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected boolean shouldReload() {
+ return false;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
index 960a449..d1d5b4e 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuery.xml
@@ -4,6 +4,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:oasis:names:tc:SAML:2.0:assertion"
Version="2.0" ID="AQ" IssueInstant="2018-03-14T17:31:00Z">
+ <Issuer>me</Issuer>
+ <Subject>
+ <NameID>you</NameID>
+ </Subject>
<Attribute Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" FriendlyName="eduPersonAssurance">
<AttributeValue xsi:type="xs:string">turquoise</AttributeValue>
</Attribute>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
index 33ccaf8..ccdc702 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/AttributeQuerySaml1.xml
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<saml1p:AttributeQuery xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- Version="2.0" ID="AQ" IssueInstant="2018-03-14T17:31:00Z">
- <Subject/>
- <Attribute AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" >
- <AttributeValue xsi:type="xs:string">turquoise</AttributeValue>
- </Attribute>
- <Attribute AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" >
- <AttributeValue xsi:type="xs:string" >blue at yellow</AttributeValue>
- </Attribute>
- <Attribute AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10"/>
-</saml1p:AttributeQuery>
+<saml1p:Request xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
+ MajorVersion="1" MinorVersion="1" RequestID="ID" IssueInstant="2019-05-02T12:00:00">
+ <saml1p:AttributeQuery>
+ <Subject>
+ <NameIdentifier>you</NameIdentifier>
+ </Subject>
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" AttributeNamespace="basic" />
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" AttributeNamespace="basic" />
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" AttributeNamespace="basic"/>
+ </saml1p:AttributeQuery>
+</saml1p:Request>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml
new file mode 100644
index 0000000..5bc3446
--- /dev/null
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/UnmappedAttributeQuerySaml1.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<saml1p:Request xmlns:saml1p="urn:oasis:names:tc:SAML:1.0:protocol" xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
+ MajorVersion="1" MinorVersion="1" RequestID="ID" IssueInstant="2019-05-02T12:00:00">
+ <saml1p:AttributeQuery>
+ <Subject>
+ <NameIdentifier>you</NameIdentifier>
+ </Subject>
+ <AttributeDesignator AttributeName="flooby" AttributeNamespace="basic" />
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" AttributeNamespace="basic" />
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" AttributeNamespace="basic" />
+ <AttributeDesignator AttributeName="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" AttributeNamespace="basic"/>
+ </saml1p:AttributeQuery>
+</saml1p:Request>
diff --git a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/saml1Mapper.xml b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/saml1Mapper.xml
index a167735..efb5c11 100644
--- a/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/saml1Mapper.xml
+++ b/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/profile/saml1Mapper.xml
@@ -1,78 +1,69 @@
<?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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+ 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"
+ 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">
- <!-- This is what we are trying to reverse map (note bi-directional aliasing, just to confuse things. And me.
-
- <AttributeDefinition xsi:type="ad:Simple" id="eduPersonAssurance" >
- <AttributeEncoder xsi:type="SAML1String" name="urn:mace:dir:attribute-def:eduPersonAssurance" />
- </AttributeDefinition>
+ <bean id="shibboleth.IdentifiableBeanPostProcessor"
+ class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" />
- <AttributeDefinition xsi:type="ad:Simple" id="otherPersonAssurance" >
- <AttributeEncoder xsi:type="SAML1String" name="urn:mace:dir:attribute-def:eduPersonAssurance" />
- </AttributeDefinition>
-
- <AttributeDefinition xsi:type="ad:Scoped" id="eduPersonScopedAffiliation" scope="example.org" >
- <AttributeEncoder xsi:type="SAML1ScopedString" name="urn:mace:dir:attribute-def:eduPersonScopedAffiliation" />
- </AttributeDefinition>
-
- <AttributeDefinition xsi:type="ad:SAML2NameID" id="eduPersonTargetedID"
- nameIdFormat="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">
- <AttributeEncoder xsi:type="SAML1XMLObject" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" />
- </AttributeDefinition>
-
+ <bean id="SAML1StringTranscoder"
+ class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML1StringAttributeTranscoder" />
+ <bean id="SAML1ScopedStringTranscoder"
+ class="net.shibboleth.idp.saml.attribute.transcoding.impl.SAML1ScopedStringAttributeTranscoder" />
+
+ <util:list id="DefaultAttributeRegistry">
+ <map>
+ <entry key="id" value="eduPersonAssurance" />
+ <entry key="transcoder" value-ref="SAML1StringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" />
+ <entry key="namespace" value="basic" />
+ </map>
+
+ <map>
+ <entry key="id" value="eduPersonAssurance" />
+ <entry key="transcoder" value-ref="SAML1StringTranscoder" />
+ <entry key="name" value="http://example.org/name/for/Attribute" />
+ <entry key="namespace" value="basic" />
+ </map>
+
+ <map>
+ <entry key="id" value="otherPersonAssurance" />
+ <entry key="transcoder" value-ref="SAML1StringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" />
+ <entry key="namespace" value="basic" />
+ </map>
+
+ <map>
+ <entry key="id" value="eduPersonScopedAffiliation" />
+ <entry key="transcoder" value-ref="SAML1ScopedStringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" />
+ <entry key="namespace" value="basic" />
+ </map>
+
+ <map>
+ <entry key="id" value="eduPersonTargetedID" />
+ <entry key="transcoder" value-ref="SAML1ScopedStringTranscoder" />
+ <entry key="name" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" />
+ <entry key="namespace" value="basic" />
+ </map>
+
+ </util:list>
- -->
-
- <bean id="abstractStringMapper" init-method="initialize" abstract="true"
- class="net.shibboleth.idp.saml.attribute.mapping.impl.SAML1AttributeDesignatorMapper">
- </bean>
+ <util:map id="DefaultNamingRegistry">
+ <entry key="#{T(org.opensaml.saml.saml1.core.AttributeDesignator)}">
+ <bean class="net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML1AttributeTranscoder.NamingFunction" />
+ </entry>
+ </util:map>
+
- <bean id="AttributesMapper"
- class="net.shibboleth.idp.saml.attribute.mapping.impl.SAML1AttributeDesignatorsMapper"
- init-method="initialize" p:id="SAML1AttributesMapper">
- <property name="mappers">
- <list>
- <bean parent="abstractStringMapper">
- <property name="id" value="eduPersonAssurance" />
- <property name="SAMLName" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.11" />
- <property name="attributeIds">
- <list>
- <value>eduPersonAssurance</value>
- <value>otherPersonAssurance</value>
- </list>
- </property>
- </bean>
- <bean parent="abstractStringMapper">
- <property name="SAMLName" value="http://example.org/name/for/Attribute" />
- <property name="id" value="otherSAMLName" />
- <property name="attributeIds">
- <list>
- <value>eduPersonAssurance</value>
- </list>
- </property>
- </bean>
- <bean parent="abstractStringMapper">
- <property name="sAMLName" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.9" />
- <property name="id" value="eduPersonScopedAffiliation" />
- <property name="attributeIds">
- <list>
- <value>eduPersonScopedAffiliation</value>
- </list>
- </property>
- </bean>
- <bean parent="abstractStringMapper">
- <property name="sAMLName" value="urn:oid:1.3.6.1.4.1.5923.1.1.1.10"/>
- <property name="id" value="eduPersonTargetedID"/>
- <property name="attributeIds">
- <list>
- <value>eduPersonTargetedID</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
+ <bean id="AttributeTranscoderRegistry" class="net.shibboleth.idp.attribute.transcoding.impl.AttributeTranscoderRegistryImpl"
+ p:namingRegistry-ref="DefaultNamingRegistry"
+ p:transcoderRegistry-ref="DefaultAttributeRegistry" />
+
</beans>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list