[java-shib-shared] branch main updated: IDP-2245 - Inject property as signal that a duplicate property was found

Scott Cantor cantor.2 at osu.edu
Thu Feb 15 17:53:17 UTC 2024


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

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=7fd4c3b82ca7d42290fa08bbd035c5c8f713e304

The following commit(s) were added to refs/heads/main by this push:
     new 7fd4c3b8 IDP-2245 - Inject property as signal that a duplicate property was found
7fd4c3b8 is described below

commit 7fd4c3b82ca7d42290fa08bbd035c5c8f713e304
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Feb 15 12:53:14 2024 -0500

    IDP-2245 - Inject property as signal that a duplicate property was found
    
    https://shibboleth.atlassian.net/browse/IDP-2245
    
    Adjust base class in shared lib to handle this.
---
 .../AbstractPropertiesApplicationContextInitializer.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
index bf00b551..d5ea87c7 100644
--- a/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
+++ b/shib-spring/src/main/java/net/shibboleth/shared/spring/context/AbstractPropertiesApplicationContextInitializer.java
@@ -120,6 +120,15 @@ public abstract class AbstractPropertiesApplicationContextInitializer
      * @return name of additional properties property
      */
     @Nonnull @NotEmpty protected abstract String getAutoSearchPropertyName();
+    
+    /**
+     * Get the name of the property to populate with duplicates detected.
+     * 
+     * @return duplicate warning property name
+     * 
+     * @since 9.1.0
+     */
+    @Nonnull @NotEmpty protected abstract String getDuplicateWarningPropertyName(); 
 
     /** {@inheritDoc} */
     public void initialize(@Nonnull final ConfigurableApplicationContext applicationContext) {
@@ -231,6 +240,10 @@ public abstract class AbstractPropertiesApplicationContextInitializer
             for (final Map.Entry<Object,Object> entry : holder.entrySet()) {
                 if (sink.putIfAbsent(entry.getKey(), entry.getValue()) != null) {
                     LOG.warn("Ignoring duplicate property '{}'", entry.getKey());
+                    
+                    // Track the duplicate in a special property for later reporting.
+                    final String warningPropertyValue = sink.getProperty(getDuplicateWarningPropertyName(), "");
+                    sink.setProperty(getDuplicateWarningPropertyName(), warningPropertyValue + "," + entry.getKey());
                 }
             }
 

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


More information about the commits mailing list