[java-identity-provider] 12/13: IDP-1811 Expose suppressDisplayInformation as a resolver plugin option 2/3

Rod Widdowson rdw at steadingsoftware.com
Sun Jun 6 11:40:52 UTC 2021


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

commit d06a3e5c59af5deae412c5f74857b3c7baf0dc3e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat May 8 13:57:11 2021 +0100

    IDP-1811 Expose suppressDisplayInformation as a resolver plugin option 2/3
    
    https://issues.shibboleth.net/jira/browse/IDP-1811
    
    Now that we do not populate the IdPAttribute with display information
    by default we can chose to ask during display in case something has
    set it up for us.
---
 .../logic/impl/AttributeDisplayDescriptionFunction.java      | 12 ++++++++++++
 .../idp/consent/logic/impl/AttributeDisplayNameFunction.java | 12 ++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayDescriptionFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayDescriptionFunction.java
index c2f743b9b..a7376db1e 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayDescriptionFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayDescriptionFunction.java
@@ -25,6 +25,9 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletRequest;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
 import net.shibboleth.utilities.java.support.service.ReloadableService;
@@ -35,6 +38,9 @@ import net.shibboleth.utilities.java.support.service.ReloadableService;
  */
 public class AttributeDisplayDescriptionFunction extends AbstractAttributeDisplayFunction {
 
+    /** Logger. */
+    private final Logger log = LoggerFactory.getLogger(AttributeDisplayDescriptionFunction.class);
+    
     /**
      * Constructor.
      * 
@@ -51,6 +57,12 @@ public class AttributeDisplayDescriptionFunction extends AbstractAttributeDispla
     /** {@inheritDoc} */
     protected Map<Locale, String> getDisplayInfo( @Nonnull final AttributeTranscoderRegistry registry,
             @Nonnull final IdPAttribute attribute) {
+        @SuppressWarnings("removal")
+        final Map<Locale, String>  fromAttribute = attribute.getDisplayDescriptions();
+        if (fromAttribute != null  && !fromAttribute.isEmpty()) {
+            log.debug("Attribute {} carried locally defines descriptions, skipping the registry", attribute.getId());
+            return fromAttribute;
+        }
         return registry.getDescriptions(attribute);
     }
 }
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
index a5f1073b7..6ee328747 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameFunction.java
@@ -25,6 +25,9 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletRequest;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
 import net.shibboleth.utilities.java.support.service.ReloadableService;
@@ -35,6 +38,9 @@ import net.shibboleth.utilities.java.support.service.ReloadableService;
  */
 public class AttributeDisplayNameFunction extends AbstractAttributeDisplayFunction {
 
+    /** Logger. */
+    private final Logger log = LoggerFactory.getLogger(AttributeDisplayNameFunction.class);
+
     /**
      * Constructor.
      * 
@@ -52,6 +58,12 @@ public class AttributeDisplayNameFunction extends AbstractAttributeDisplayFuncti
     @Override @Nonnull protected Map<Locale, String> getDisplayInfo(
             @Nonnull final AttributeTranscoderRegistry registry,
             @Nonnull final IdPAttribute attribute) {
+        @SuppressWarnings("removal")
+        final Map<Locale, String>  fromAttribute = attribute.getDisplayNames();
+        if (fromAttribute != null && !fromAttribute.isEmpty()) {
+            log.debug("Attribute {} carried locally defined names, skipping the registry", attribute.getId());
+            return fromAttribute;
+        }
         return  registry.getDisplayNames(attribute);
     }
 }

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


More information about the commits mailing list