[java-identity-provider] branch main updated: IDP-2375 Aliased decoded IdPAttributes are lost during subsequent use

Rod Widdowson rdw at steadingsoftware.com
Tue Apr 22 13:16:05 UTC 2025


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=d783b88861e60a826b6461aa8f51ddcfc650e15d

The following commit(s) were added to refs/heads/main by this push:
     new d783b8886 IDP-2375 Aliased decoded IdPAttributes are lost during subsequent use
d783b8886 is described below

commit d783b88861e60a826b6461aa8f51ddcfc650e15d
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Apr 22 14:14:44 2025 +0100

    IDP-2375 Aliased decoded IdPAttributes are lost during subsequent use
    
    https://shibboleth.atlassian.net/browse/IDP-2375
    
    Move away from deprecated APIs
---
 .../shibboleth/idp/authn/impl/ExternalAuthenticationImpl.java    | 8 ++++++--
 .../idp/authn/impl/ValidateExternalAuthentication.java           | 4 ++--
 .../impl/AttributeSourcedSubjectCanonicalizationActionTest.java  | 8 ++++----
 .../authn/impl/AttributeSourcedSubjectCanonicalizationTest.java  | 2 +-
 .../shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java   | 2 +-
 .../consent/flow/ar/impl/AbstractAttributeReleaseActionTest.java | 2 +-
 .../flow/ar/impl/PopulateAttributeReleaseContextTest.java        | 7 +++----
 .../idp/consent/logic/impl/AttributeValueLookupFunctionTest.java | 8 ++++----
 .../java/net/shibboleth/idp/profile/impl/FilterAttributes.java   | 6 +++---
 .../java/net/shibboleth/idp/profile/impl/ResolveAttributes.java  | 4 ++--
 .../saml1/profile/impl/FilterByQueriedAttributeDesignators.java  | 7 ++++---
 .../idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java   | 6 ++++--
 .../shibboleth/idp/profile/impl/tests/FilterAttributesTest.java  | 9 +++++----
 13 files changed, 40 insertions(+), 33 deletions(-)

diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ExternalAuthenticationImpl.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ExternalAuthenticationImpl.java
index fa08db859..aa8cc2be6 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ExternalAuthenticationImpl.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ExternalAuthenticationImpl.java
@@ -19,6 +19,7 @@ import java.security.Principal;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.Collection;
+import java.util.Map;
 import java.util.function.Function;
 
 import javax.annotation.Nonnull;
@@ -30,6 +31,7 @@ import org.opensaml.profile.context.ProfileRequestContext;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
 import net.shibboleth.idp.attribute.IdPAttribute;
+import net.shibboleth.idp.attribute.IdPAttributeSupport;
 import net.shibboleth.idp.attribute.context.AttributeContext;
 import net.shibboleth.idp.authn.ExternalAuthentication;
 import net.shibboleth.idp.authn.ExternalAuthenticationException;
@@ -146,8 +148,10 @@ public class ExternalAuthenticationImpl extends ExternalAuthentication {
         
         if (request.getAttribute(ATTRIBUTES_KEY) instanceof Collection<?> attrs) {
             final AttributeContext ac = extContext.ensureSubcontext(AttributeContext.class);
-            ac.setUnfilteredIdPAttributes((Collection<IdPAttribute>) attrs);
-            ac.setIdPAttributes((Collection<IdPAttribute>) attrs);
+            final Map<String, IdPAttribute> attributes = IdPAttributeSupport.toMapMergeDuplicates((Collection<IdPAttribute>) attrs);
+
+            ac.setUnfilteredIdPAttributes(attributes);
+            ac.setIdPAttributes(attributes);
         }
         
         if (request.getAttribute(AUTHENTICATION_ERROR_KEY) instanceof String s) {
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java
index 7de0c6c74..e53973edd 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java
@@ -385,7 +385,7 @@ public class ValidateExternalAuthentication extends AbstractAuditingValidationAc
             final AttributeFilter filter = component.getComponent();
             filter.filterAttributes(filterContext);
             filterContext.removeFromParent();
-            ac.setIdPAttributes(filterContext.getFilteredIdPAttributes().values());
+            ac.setIdPAttributes(filterContext.getFilteredIdPAttributes());
         } catch (final AttributeFilterException e) {
             log.error("{} Error while filtering inbound attributes", getLogPrefix(), e);
             ac.setIdPAttributes((Map<String, IdPAttribute>)null);
@@ -409,7 +409,7 @@ public class ValidateExternalAuthentication extends AbstractAuditingValidationAc
         final ExternalAuthenticationContext ec = extContext;
         assert ac != null && ec != null;
         filterContext.setDirection(Direction.INBOUND)
-            .setPrefilteredIdPAttributes(ac.getIdPAttributes().values())
+            .setPrefilteredIdPAttributes(ac.getIdPAttributes())
             .setMetadataResolver(metadataResolver)
             .setRequesterMetadataContextLookupStrategy(null)
             .setProxiedRequesterContextLookupStrategy(null);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationActionTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationActionTest.java
index d9f671cbf..8adea6e9f 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationActionTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationActionTest.java
@@ -97,7 +97,7 @@ public class AttributeSourcedSubjectCanonicalizationActionTest extends BaseAuthe
         final SubjectCanonicalizationContext sc = prc.ensureSubcontext(SubjectCanonicalizationContext.class);
         sc.setSubject(new Subject());
         
-        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singleton(inputAttribute));
+        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singletonMap(inputAttribute.getId(), inputAttribute));
         
         final Event event = action.execute(src);
         
@@ -154,7 +154,7 @@ public class AttributeSourcedSubjectCanonicalizationActionTest extends BaseAuthe
         sc.setSubject(subject);
         subject.getPrincipals().add(new IdPAttributePrincipal(attr2));
         
-        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singleton(attr2bar));
+        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singletonMap(attr2bar.getId(), attr2bar));
         
         Event event = action.execute(src);
         
@@ -163,7 +163,7 @@ public class AttributeSourcedSubjectCanonicalizationActionTest extends BaseAuthe
 
         subject.getPrincipals().clear();
         subject.getPrincipals().add(new IdPAttributePrincipal(attr2bar));
-        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singleton(attr2));
+        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singletonMap(attr2.getId(),attr2));
 
         event = action.execute(src);
         
@@ -186,7 +186,7 @@ public class AttributeSourcedSubjectCanonicalizationActionTest extends BaseAuthe
         sc.setSubject(subject);
         subject.getPrincipals().add(new IdPAttributePrincipal(attr2));
         
-        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singleton(attr1));
+        sc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singletonMap(attr1.getId(), attr1));
         
         final Event event = action.execute(src);
         
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationTest.java
index 22f8b6708..c649ec60c 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/AttributeSourcedSubjectCanonicalizationTest.java
@@ -188,7 +188,7 @@ public class AttributeSourcedSubjectCanonicalizationTest extends BaseAuthenticat
 
         subject.getPrincipals().clear();
         subject.getPrincipals().add(new IdPAttributePrincipal(attr2bar));
-        scc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singleton(attr2));
+        scc.ensureSubcontext(AttributeContext.class).setIdPAttributes(CollectionSupport.singletonMap(attr2.getId(), attr2));
 
         event = action.apply(scc);
         
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
index 80d98feb6..0e7840f0c 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/flow/ar/impl/ReleaseAttributes.java
@@ -100,7 +100,7 @@ public class ReleaseAttributes extends AbstractAttributeReleaseAction {
             log.debug("{} Not releasing attributes: {}", getLogPrefix(), diff.entriesOnlyOnLeft().keySet());
         }
 
-        attributeContext.setIdPAttributes(releasedAttributes.values());
+        attributeContext.setIdPAttributes(releasedAttributes);
     }
 
 }
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/AbstractAttributeReleaseActionTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/AbstractAttributeReleaseActionTest.java
index 43ceccaa3..5b82a6818 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/AbstractAttributeReleaseActionTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/AbstractAttributeReleaseActionTest.java
@@ -33,7 +33,7 @@ public abstract class AbstractAttributeReleaseActionTest extends AbstractConsent
      */
     @BeforeMethod public void setUpAttributeReleaseAction() throws Exception {
         final AttributeContext attributeCtx = new AttributeContext();
-        attributeCtx.setIdPAttributes(ConsentTestingSupport.newAttributeMap().values());
+        attributeCtx.setIdPAttributes(ConsentTestingSupport.newAttributeMap());
         prc.ensureSubcontext(RelyingPartyContext.class).addSubcontext(attributeCtx);
 
         prc.addSubcontext(new AttributeReleaseContext(), true);
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/PopulateAttributeReleaseContextTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/PopulateAttributeReleaseContextTest.java
index 4c0804254..46faf4843 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/PopulateAttributeReleaseContextTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/ar/impl/PopulateAttributeReleaseContextTest.java
@@ -14,7 +14,7 @@
 
 package net.shibboleth.idp.consent.flow.ar.impl;
 
-import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -135,9 +135,8 @@ public class PopulateAttributeReleaseContextTest extends AbstractAttributeReleas
         orderedAttributes.put("attribute1", ConsentTestingSupport.newAttributeMap().get("attribute1"));
         orderedAttributes.put("attribute4", attribute4);
 
-        final List<IdPAttribute> attributes = new ArrayList<>();
-        attributes.addAll(ConsentTestingSupport.newAttributeMap().values());
-        attributes.add(attribute4);
+        final Map<String, IdPAttribute> attributes = new HashMap<>(ConsentTestingSupport.newAttributeMap());
+        attributes.put(attribute4.getId(), attribute4);
         final RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
         assert rpCtx != null;
         final AttributeContext ac = rpCtx.getSubcontext(AttributeContext.class);
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunctionTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunctionTest.java
index 261e3a0c1..a13de8dee 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunctionTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeValueLookupFunctionTest.java
@@ -52,13 +52,13 @@ public class AttributeValueLookupFunctionTest {
         final AttributeContext attributeCtx = new AttributeContext();
         
         final Map<String, IdPAttribute> attributes = ConsentTestingSupport.newAttributeMap();
-        attributeCtx.setIdPAttributes(attributes.values());
+        attributeCtx.setIdPAttributes(attributes);
         
         final Map<String, IdPAttribute> unfilteredAttributes = ConsentTestingSupport.newAttributeMap();
         final IdPAttribute attribute4 = new IdPAttribute("attribute4");
         attribute4.setValues(CollectionSupport.singletonList(new StringAttributeValue("value4")));
         unfilteredAttributes.put(attribute4.getId(), attribute4);
-        attributeCtx.setUnfilteredIdPAttributes(unfilteredAttributes.values());
+        attributeCtx.setUnfilteredIdPAttributes(unfilteredAttributes);
         
         prc.ensureSubcontext(RelyingPartyContext.class).addSubcontext(attributeCtx);
     }
@@ -93,7 +93,7 @@ public class AttributeValueLookupFunctionTest {
         final AttributeContext attributeCtx =
                 prc.ensureSubcontext(RelyingPartyContext.class).getSubcontext(AttributeContext.class);
         assert attributeCtx!=null;
-        attributeCtx.setIdPAttributes(CollectionSupport.singleton(new IdPAttribute("EmptyAttribute")));
+        attributeCtx.setIdPAttributes(CollectionSupport.singletonMap("EmptyAttribute", new IdPAttribute("EmptyAttribute")));
 
         function = new AttributeValueLookupFunction("EmptyAttribute");
         Assert.assertNull(function.apply(prc));
@@ -108,7 +108,7 @@ public class AttributeValueLookupFunctionTest {
         final AttributeContext attributeCtx =
                 prc.ensureSubcontext(RelyingPartyContext.class).getSubcontext(AttributeContext.class);
         assert attributeCtx!=null;
-        attributeCtx.setIdPAttributes(CollectionSupport.singleton(byteAttribute));
+        attributeCtx.setIdPAttributes(CollectionSupport.singletonMap(byteAttribute.getId(), byteAttribute));
 
         function = new AttributeValueLookupFunction("ByteAttribute");
         Assert.assertNull(function.apply(prc));
diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
index 14e6c725d..c7202368b 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
@@ -392,12 +392,12 @@ public class FilterAttributes extends AbstractProfileAction {
             final AttributeFilter filter = component.getComponent();
             filter.filterAttributes(filterContext);
             filterContext.removeFromParent();
-            attributeContext.setIdPAttributes(filterContext.getFilteredIdPAttributes().values());
+            attributeContext.setIdPAttributes(filterContext.getFilteredIdPAttributes());
         } catch (final AttributeFilterException e) {
             log.error("{} Error encountered while filtering attributes", getLogPrefix(), e);
             if (maskFailures) {
                 log.warn("Filter error masked, clearing resolved attributes");
-                attributeContext.setIdPAttributes(CollectionSupport.emptySet());
+                attributeContext.setIdPAttributes(CollectionSupport.emptyMap());
             } else {
                 ActionSupport.buildEvent(profileRequestContext, IdPEventIds.UNABLE_FILTER_ATTRIBS);
             }
@@ -443,7 +443,7 @@ public class FilterAttributes extends AbstractProfileAction {
         // then look for them in the AttributeContext.
         if (filterContext.getPrefilteredIdPAttributes().isEmpty()) {
             assert attributeContext != null;
-            filterContext.setPrefilteredIdPAttributes(attributeContext.getIdPAttributes().values());
+            filterContext.setPrefilteredIdPAttributes(attributeContext.getIdPAttributes());
         }
     }
 
diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
index e36247044..818f5f2b7 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
@@ -279,8 +279,8 @@ public final class ResolveAttributes extends AbstractProfileAction {
             if (null == attributeCtx) {
                 throw new ResolutionException("Unable to create or locate AttributeContext to populate");
             }
-            attributeCtx.setIdPAttributes(resolutionContext.getResolvedIdPAttributes().values());
-            attributeCtx.setUnfilteredIdPAttributes(resolutionContext.getResolvedIdPAttributes().values());
+            attributeCtx.setIdPAttributes(resolutionContext.getResolvedIdPAttributes());
+            attributeCtx.setUnfilteredIdPAttributes(resolutionContext.getResolvedIdPAttributes());
         } catch (final ResolutionException e) {
             log.error("{} Error resolving attributes", getLogPrefix(), e);
             if (!maskFailures) {
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 0077f17ac..80d31394f 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
@@ -14,10 +14,11 @@
 
 package net.shibboleth.idp.saml.saml1.profile.impl;
 
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.function.Function;
 
@@ -191,13 +192,13 @@ public class FilterByQueriedAttributeDesignators extends AbstractProfileAction {
             return;
         }
 
-        final Collection<IdPAttribute> keepers = new ArrayList<>(query.getAttributeDesignators().size());
+        final Map<String, IdPAttribute> keepers = new HashMap<>(query.getAttributeDesignators().size());
         log.debug("Query content mapped to attribute IDs: {}", decodedAttributeIds);
         
         for (final IdPAttribute attribute : attributeContext.getIdPAttributes().values()) {
             if (decodedAttributeIds.contains(attribute.getId())) {
                 log.debug("Retaining attribute '{}' requested by query", attribute.getId());
-                keepers.add(attribute);
+                keepers.put(attribute.getId(), attribute);
             } else {
                 log.debug("Removing attribute '{}' not requested by query", attribute.getId());
             }
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
index a627465c1..9e74f3f9d 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributes.java
@@ -16,7 +16,9 @@ package net.shibboleth.idp.saml.saml2.profile.impl;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.function.Function;
 
 import javax.annotation.Nonnull;
@@ -191,7 +193,7 @@ public class FilterByQueriedAttributes extends AbstractProfileAction {
                 
         log.debug("{} Query content mapped to attribute IDs: {}", getLogPrefix(), mapped.keySet());
 
-        final Collection<IdPAttribute> keepers = new ArrayList<>(query.getAttributes().size());
+        final Map<String, IdPAttribute> keepers = new HashMap<>(query.getAttributes().size());
         
         for (final IdPAttribute attribute : attributeContext.getIdPAttributes().values()) {
             
@@ -205,7 +207,7 @@ public class FilterByQueriedAttributes extends AbstractProfileAction {
                 if (count > 0) {
                     log.debug("{} Retaining requested attribute '{}' with {} value(s)", getLogPrefix(),
                             attribute.getId(), count);
-                    keepers.add(attribute);
+                    keepers.put(attribute.getId(), attribute);
                 } else {
                     log.debug("{} Removing requested attribute '{}', no values left after filtering", getLogPrefix(),
                             attribute.getId());
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/profile/impl/tests/FilterAttributesTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/profile/impl/tests/FilterAttributesTest.java
index 3eaac1590..ed78b9e78 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/profile/impl/tests/FilterAttributesTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/profile/impl/tests/FilterAttributesTest.java
@@ -20,6 +20,7 @@ import java.util.Map;
 import javax.annotation.Nonnull;
 
 import net.shibboleth.idp.attribute.IdPAttribute;
+import net.shibboleth.idp.attribute.IdPAttributeSupport;
 import net.shibboleth.idp.attribute.IdPAttributeValue;
 import net.shibboleth.idp.attribute.StringAttributeValue;
 import net.shibboleth.idp.attribute.context.AttributeContext;
@@ -141,7 +142,7 @@ public class FilterAttributesTest {
         prc.ensureSubcontext(SubjectContext.class);
 
         final AttributeContext attributeCtx = new AttributeContext();
-        attributeCtx.setIdPAttributes(attributes);
+        attributeCtx.setIdPAttributes(IdPAttributeSupport.toMapMergeDuplicates(attributes));
         final RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
         assert rpCtx!= null;
         rpCtx.addSubcontext(attributeCtx);
@@ -205,7 +206,7 @@ public class FilterAttributesTest {
         prc.ensureSubcontext(SubjectContext.class);
 
         final AttributeContext attributeCtx = new AttributeContext();
-        attributeCtx.setIdPAttributes(attributes);
+        attributeCtx.setIdPAttributes(IdPAttributeSupport.toMapMergeDuplicates(attributes));
         final RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
         assert rpCtx!= null;
         rpCtx.addSubcontext(attributeCtx);
@@ -268,7 +269,7 @@ public class FilterAttributesTest {
         prc.ensureSubcontext(SubjectContext.class);
 
         final AttributeContext attributeCtx = new AttributeContext();
-        attributeCtx.setIdPAttributes(attributes);
+        attributeCtx.setIdPAttributes(IdPAttributeSupport.toMapMergeDuplicates(attributes));
         final RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
         assert rpCtx!= null;
         rpCtx.addSubcontext(attributeCtx);
@@ -297,7 +298,7 @@ public class FilterAttributesTest {
 
         final AttributeContext attributeCtx = new AttributeContext();
         final List<IdPAttribute> attributes = CollectionSupport.singletonList(attribute1);
-        attributeCtx.setIdPAttributes(attributes);
+        attributeCtx.setIdPAttributes(IdPAttributeSupport.toMapMergeDuplicates(attributes));
         final RelyingPartyContext rpCtx = prc.getSubcontext(RelyingPartyContext.class);
         assert rpCtx!= null;
         rpCtx.addSubcontext(attributeCtx);

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


More information about the commits mailing list