[java-plugin-shibd] branch main updated: Guard agent ID mappings to flag duplicates.

Codeberg noreply at shibboleth.net
Mon Mar 9 23:55:09 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-plugin-shibd.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/1f5bed35125f5ac8366d372d6636973821c2baa5

The following commit(s) were added to refs/heads/main by this push:
     new 1f5bed3  Guard agent ID mappings to flag duplicates.
1f5bed3 is described below

commit 1f5bed35125f5ac8366d372d6636973821c2baa5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Mar 9 19:54:55 2026 -0400

    Guard agent ID mappings to flag duplicates.
---
 .../shibboleth/sp/impl/DefaultAgentResolver.java    | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultAgentResolver.java b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultAgentResolver.java
index 121b51a..0f72a43 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultAgentResolver.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/impl/DefaultAgentResolver.java
@@ -65,10 +65,27 @@ public class DefaultAgentResolver extends IdentifiedComponentManager<Agent> impl
         log.debug("Initializing with Agents: {}", getComponents());
 
         // Install agent mappings against all the usernames (falling back to the agent ID).
+        
         for (final Agent agent : getComponents()) {
-            agentMap.put(agent.getId(), agent);
+            if (agentMap.containsKey(agent.getId())) {
+                log.warn("Ignoring duplicate mapping for Agent ID: {}", agent.getId());
+            } else {
+                agentMap.put(agent.getId(), agent);
+            }
+            
             for (final Map.Entry<String,String> creds : agent.getCredentials().entrySet()) {
-                agentMap.put(creds.getKey() != null ? creds.getKey() : agent.getId(), agent);
+                final String key = creds.getKey();
+                if (key != null) {
+                    if (agentMap.containsKey(key)) {
+                        log.warn("Ignoring duplicate mapping for Agent username: {}", key);
+                    } else {
+                        agentMap.put(key, agent);
+                    }
+                } else {
+                    // This may involve duplicates, but we know they're all for this Agent since
+                    // the map was checked above for the Agent ID.
+                    agentMap.put(agent.getId(), agent);
+                }
             }
         }
     }

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


More information about the commits mailing list