[java-identity-provider] 02/02: IDP-1647 Dedupe unmodifiable maps in UIInfo elements

Rod Widdowson rdw at steadingsoftware.com
Sun Jul 26 14:43:27 UTC 2020


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=0723d7ce850cca0926ce68ac0782942361d61306

commit 0723d7ce850cca0926ce68ac0782942361d61306
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Jul 26 15:42:54 2020 +0100

    IDP-1647 Dedupe unmodifiable maps in UIInfo elements
    
    https://issues.shibboleth.net/jira/browse/IDP-1647
---
 .../net/shibboleth/idp/saml/metadata/ACSUIInfo.java   |  8 ++++++--
 .../net/shibboleth/idp/saml/metadata/IdPUIInfo.java   | 19 ++++++++++++++-----
 .../idp/saml/metadata/OrganizationUIInfo.java         | 13 +++++++++----
 3 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/ACSUIInfo.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/ACSUIInfo.java
index 689958bbc..6556c3903 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/ACSUIInfo.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/ACSUIInfo.java
@@ -30,6 +30,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.collection.CollectionSupport;
 
 /**
  * Class to contain a processed form of the {@link AttributeConsumingService} suitable for display purposes. */
@@ -73,14 +74,17 @@ public class ACSUIInfo {
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         serviceName -> Locale.forLanguageTag(serviceName.getXMLLang()), 
-                        serviceName -> serviceName.getValue()));
+                        serviceName -> serviceName.getValue(),
+                        CollectionSupport.warningMergeFunction("ServiceName", false)));
+
         serviceDescriptions = acs.
                 getDescriptions().
                 stream().
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         description -> Locale.forLanguageTag(description.getXMLLang()), 
-                        description -> description.getValue()));
+                        description -> description.getValue(),
+                        CollectionSupport.warningMergeFunction("ServiceDescription", false)));
     }
 
     /** 
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
index c9307796d..4ca6cff8e 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/IdPUIInfo.java
@@ -37,6 +37,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.collection.CollectionSupport;
 
 /**
  * Class to contain a processed form of the {@link UIInfo} suitable for display purposes. */
@@ -122,35 +123,43 @@ public class IdPUIInfo {
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         displayName -> Locale.forLanguageTag(displayName.getXMLLang()), 
-                        displayName -> displayName.getValue()));
+                        displayName -> displayName.getValue(),
+                        CollectionSupport.warningMergeFunction("IdpUIInfo DisplayName", false)));
         keywordList = uiInfo.
                 getKeywords().
                 stream().
                 filter(nullLanguageKeyword).
                 collect(Collectors.toUnmodifiableMap(
                         keywords -> Locale.forLanguageTag(keywords.getXMLLang()), 
-                        keywords -> keywords.getKeywords()));
+                        keywords -> keywords.getKeywords(),
+                        CollectionSupport.warningMergeFunction("IdpUIInfo Keyword", false)));
+
         descriptions = uiInfo.
                 getDescriptions().
                 stream().
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         description -> Locale.forLanguageTag(description.getXMLLang()), 
-                        description -> description.getValue()));
+                        description -> description.getValue(),
+                        CollectionSupport.warningMergeFunction("IdpUIInfo Descriptions", false)));
+
         informationURLs = uiInfo.
                 getInformationURLs().
                 stream().
                 filter(nullLanguageURL).
                 collect(Collectors.toUnmodifiableMap(
                         url -> Locale.forLanguageTag(url.getXMLLang()), 
-                        dn -> dn.getURI()));
+                        dn -> dn.getURI(),
+                        CollectionSupport.warningMergeFunction("IdpUIInfo InformationURL", false)));
+
         privacyStatementURLs = uiInfo.
                 getPrivacyStatementURLs().
                 stream().
                 filter(nullLanguageURL).
                 collect(Collectors.toUnmodifiableMap(
                         url -> Locale.forLanguageTag(url.getXMLLang()), 
-                        url -> url.getURI()));
+                        url -> url.getURI(),
+                        CollectionSupport.warningMergeFunction("IdpUIInfo PrivacyStatementURL", false)));
         
         final List<Logo> noLocaleLogo = new ArrayList<>();
         final Map<Locale, List<Logo>> withLocaleLogo = new HashMap<>();
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfo.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfo.java
index b9bc9e47f..360a3e66d 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfo.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/metadata/OrganizationUIInfo.java
@@ -31,6 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.collection.CollectionSupport;
 
 /**
  * Class to contain a processed form of the {@link Organization} suitable for display purposes. */
@@ -93,22 +94,26 @@ public class OrganizationUIInfo {
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         serviceName -> Locale.forLanguageTag(serviceName.getXMLLang()), 
-                        serviceName -> serviceName.getValue()));
+                        serviceName -> serviceName.getValue(),
+                        CollectionSupport.warningMergeFunction("OrganizationUIInfo OrganizationName", false)));
+
         displayNames = organization.
                 getDisplayNames().
                 stream().
                 filter(nullLanguageString).
                 collect(Collectors.toUnmodifiableMap(
                         description -> Locale.forLanguageTag(description.getXMLLang()), 
-                        description -> description.getValue()));
-        
+                        description -> description.getValue(),
+                        CollectionSupport.warningMergeFunction("OrganizationUIInfo DisplayNames", false)));
+
         urls = organization.
                 getURLs().
                 stream().
                 filter(nullLanguageURL).
                 collect(Collectors.toUnmodifiableMap(
                         url -> Locale.forLanguageTag(url.getXMLLang()), 
-                        dn -> dn.getURI()));
+                        dn -> dn.getURI(),
+                        CollectionSupport.warningMergeFunction("OrganizationUIInfo URL", false)));
     }
 
     /** 

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


More information about the commits mailing list