Alon Bar-Lev has uploaded a new change for review.

Change subject: aaa: issue warning on duplicate profile name
......................................................................

aaa: issue warning on duplicate profile name

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1181603
Change-Id: I5622a8ea0189cfce49008e978527c0e20b849908
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M 
backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfile.java
M 
backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfileRepository.java
2 files changed, 14 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/36850/1

diff --git 
a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfile.java
 
b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfile.java
index c85906c..305b518 100644
--- 
a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfile.java
+++ 
b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfile.java
@@ -67,6 +67,10 @@
         return mapper;
     }
 
+    public String getAuthnName() {
+        return authn.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME);
+    }
+
     public String getAuthzName() {
         return authz.getContext().<String>get(Base.ContextKeys.INSTANCE_NAME);
     }
diff --git 
a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfileRepository.java
 
b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfileRepository.java
index f8a18fb..cba38ab 100644
--- 
a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfileRepository.java
+++ 
b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/AuthenticationProfileRepository.java
@@ -85,7 +85,16 @@
                         mapperName != null ? 
EngineExtensionsManager.getInstance().getExtensionByName(mapperName) : null
                         );
 
-                results.put(profile.getName(), profile);
+                if (results.containsKey(profile.getName())) {
+                    log.warn(
+                            "Profile name '{}' already registered for '{}', 
ignoring for '{}'",
+                            profile.getName(),
+                            results.get(profile.getName()).getAuthnName(),
+                            profile.getAuthnName()
+                    );
+                } else {
+                    results.put(profile.getName(), profile);
+                }
             } catch (ConfigurationException e) {
                 log.debug("Ignoring", e);
             }


-- 
To view, visit http://gerrit.ovirt.org/36850
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5622a8ea0189cfce49008e978527c0e20b849908
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to