IGNITE-843 Hide token

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

Branch: refs/heads/ignite-843-rc1
Commit: e4078904f2ef611d1dd0fb1030b7c281023a24f1
Parents: 8c176b4
Author: Andrey <[email protected]>
Authored: Fri Oct 16 17:36:19 2015 +0700
Committer: Andrey <[email protected]>
Committed: Fri Oct 16 17:36:19 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/agent/AgentConfiguration.java  | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e4078904/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
----------------------------------------------------------------------
diff --git 
a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
 
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
index f13e183..87d0cdf 100644
--- 
a/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
+++ 
b/modules/control-center-agent/src/main/java/org/apache/ignite/agent/AgentConfiguration.java
@@ -259,8 +259,19 @@ public class AgentConfiguration {
     @Override public String toString() {
         StringBuilder sb = new StringBuilder();
 
-        if (tok != null)
-            sb.append("User's security token         : 
").append(token()).append('\n');
+        if (tok != null && tok.length() > 0) {
+            sb.append("User's security token         : ");
+
+            if (tok.length() > 4) {
+                sb.append(new String(new char[tok.length() - 4]).replace("\0", 
"*"));
+
+                sb.append(tok.substring(tok.length() - 4));
+            }
+            else
+                sb.append(new String(new char[tok.length()]).replace("\0", 
"*"));
+
+            sb.append('\n');
+        }
 
         sb.append("URI to Ignite node REST server: ").append(nodeUri == null ? 
DFLT_NODE_URI : nodeUri).append('\n');
         sb.append("URI to Ignite Console server  : ").append(srvUri == null ? 
DFLT_SERVER_URI : srvUri).append('\n');

Reply via email to