You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/05/14 12:26:10 UTC

git commit: [KARAF-132] The user name for the main console session is always "karaf"

Repository: karaf
Updated Branches:
  refs/heads/master 06dee189a -> e5e50310a


[KARAF-132] The user name for the main console session is always "karaf"

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

Branch: refs/heads/master
Commit: e5e50310a976cf7a91cba80e656659cbeee39e2b
Parents: 06dee18
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Wed May 14 12:26:01 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Wed May 14 12:26:01 2014 +0200

----------------------------------------------------------------------
 .../src/main/resources/resources/etc/system.properties       | 7 ++++++-
 .../karaf/shell/impl/console/osgi/LocalConsoleManager.java   | 8 +++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/e5e50310/assemblies/features/framework/src/main/resources/resources/etc/system.properties
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/src/main/resources/resources/etc/system.properties b/assemblies/features/framework/src/main/resources/resources/etc/system.properties
index 147a85b..5b4b2e1 100644
--- a/assemblies/features/framework/src/main/resources/resources/etc/system.properties
+++ b/assemblies/features/framework/src/main/resources/resources/etc/system.properties
@@ -66,7 +66,12 @@ karaf.clean.all = false
 karaf.clean.cache = false
 
 #
-# Roles to use when logging into a local Karaf console.
+# User name for the Karaf local console.
+#
+karaf.local.user = karaf
+
+#
+# Roles to use when for the default user in the local Karaf console.
 #
 # The syntax is the following:
 #   [classname:]principal

http://git-wip-us.apache.org/repos/asf/karaf/blob/e5e50310/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
----------------------------------------------------------------------
diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
index 69c4afb..1c30dd0 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/LocalConsoleManager.java
@@ -106,8 +106,14 @@ public class LocalConsoleManager {
     }
 
     private Subject createLocalKarafSubject() {
+
+        String userName = System.getProperty("karaf.local.user");
+        if (userName == null) {
+            userName = "karaf";
+        }
+
         final Subject subject = new Subject();
-        subject.getPrincipals().add(new UserPrincipal("karaf"));
+        subject.getPrincipals().add(new UserPrincipal(userName));
 
         String roles = System.getProperty("karaf.local.roles");
         if (roles != null) {