karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject karaf git commit: [KARAF-3774] Filter group in Karaf client
Date Mon, 29 Jun 2015 15:11:42 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 416db2d11 -> 6b4b4d050


[KARAF-3774] Filter group in Karaf client


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/6b4b4d05
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/6b4b4d05
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/6b4b4d05

Branch: refs/heads/karaf-3.0.x
Commit: 6b4b4d050b893cafc1363ed2778ed812ab1792ed
Parents: 416db2d
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Mon Jun 29 17:11:15 2015 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Mon Jun 29 17:11:15 2015 +0200

----------------------------------------------------------------------
 .../org/apache/karaf/client/ClientConfig.java     | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/6b4b4d05/client/src/main/java/org/apache/karaf/client/ClientConfig.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/karaf/client/ClientConfig.java b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
index 0516ab0..ca60607 100644
--- a/client/src/main/java/org/apache/karaf/client/ClientConfig.java
+++ b/client/src/main/java/org/apache/karaf/client/ClientConfig.java
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -155,11 +156,20 @@ public class ClientConfig {
         Properties usersCfg = loadProps(new File(System.getProperty("karaf.etc") + "/users.properties"));
         if (!usersCfg.isEmpty()) {
             if (user == null) {
-                user = (String) usersCfg.keySet().iterator().next();
+                Set keys = usersCfg.keySet();
+                for (Object key : keys) {
+                    String s = (String) key;
+                    if (s != null && !s.startsWith("_g_")) {
+                        user = s;
+                        break;
+                    }
+                }
             }
-            password = (String) usersCfg.getProperty(user);
-            if (password != null && password.contains(ROLE_DELIMITER)) {
-                password = password.substring(0, password.indexOf(ROLE_DELIMITER));
+            if (user != null) {
+                password = usersCfg.getProperty(user);
+                if (password != null && password.contains(ROLE_DELIMITER)) {
+                    password = password.substring(0, password.indexOf(ROLE_DELIMITER));
+                }
             }
         }
 


Mime
View raw message