You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2017/01/28 18:52:12 UTC

[01/13] incubator-guacamole-client git commit: GUACAMOLE-47: Implement support for client hostname/IP token for connections.

Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master d8f9d26bd -> 0d6500396


GUACAMOLE-47: Implement support for client hostname/IP token for connections.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/797bb86a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/797bb86a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/797bb86a

Branch: refs/heads/master
Commit: 797bb86a4390504ab02afed8bf544b44fbad1af0
Parents: d45580f
Author: Nick Couchman <ni...@yahoo.com>
Authored: Fri Jan 6 19:24:50 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Fri Jan 6 19:24:50 2017 -0500

----------------------------------------------------------------------
 .../apache/guacamole/token/StandardTokens.java  | 17 ++++++++
 .../org/apache/guacamole/rest/APIRequest.java   | 43 ++++++++++++++++++++
 2 files changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/797bb86a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
index 8c4655a..4bf4221 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
@@ -42,6 +42,16 @@ public class StandardTokens {
     public static final String PASSWORD_TOKEN = "GUAC_PASSWORD";
 
     /**
+     * The name of the client token added via addStandardTokens().
+     */
+    public static final String CLIENT_HOST_TOKEN = "GUAC_CLIENT_HOST";
+
+    /**
+     * The IP of the client token added via addStandardTokens().
+     */
+    public static final String CLIENT_IP_TOKEN = "GUAC_CLIENT_IP";
+
+    /**
      * The name of the date token (server-local time) added via
      * addStandardTokens().
      */
@@ -115,6 +125,13 @@ public class StandardTokens {
         if (password != null)
             filter.setToken(PASSWORD_TOKEN, password);
 
+        // Add client hostname and ip tokens
+        HttpServletRequest request = credentials.getRequest();
+        if (request != null) {
+            filter.setToken(CLIENT_HOST_TOKEN, request.getRemoteHost());
+            filter.setToken(CLIENT_IP_TOKEN, request.getRemoteAddr());
+        }
+
         // Add any tokens which do not require credentials
         addStandardTokens(filter);
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/797bb86a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 530b4dc..6a49c3e 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -42,6 +42,16 @@ public class APIRequest extends HttpServletRequestWrapper {
     private final Map<String, String[]> parameters;
 
     /**
+     * The remote hostname that initiated the request.
+     */
+    private final String remoteHost;
+
+    /**
+     * The remote ip address that initiated the request.
+     */
+    private final String remoteAddr;
+
+    /**
      * Wraps the given HttpServletRequest, using the given MultivaluedMap to
      * provide all request parameters. All HttpServletRequest functions which
      * do not deal with parameter names and values are delegated to the wrapped
@@ -58,6 +68,29 @@ public class APIRequest extends HttpServletRequestWrapper {
 
         super(request);
 
+        // Try a few methods to get client info.
+        String clientHostname = "";
+        String clientAddress = "";
+        if(request.getHeader("X-Guacamole-Client-Hostname") != "") {
+            this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
+        } else if(request.getHeader("X-Forwarded-For") != "") {
+            this.remoteHost = request.getHeader("X-Forwarded-For");
+        } else if(request.getRemoteHost() != "") {
+            this.remoteHost = request.getRemoteHost();
+        } else {
+            this.remoteHost = "";
+        }
+
+        if(request.getHeader("X-Guacamole-Client-IP") != "") {
+            this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
+        } else if(request.getHeader("X-Forwarded-For") != "") {
+            this.remoteAddr = request.getHeader("X-Forwarded-For");
+        } else if(request.getRemoteAddr() != "") {
+            this.remoteAddr = request.getRemoteAddr();
+        } else {
+            this.remoteAddr = "";
+        }
+
         // Copy parameters from given MultivaluedMap 
         this.parameters = new HashMap<String, String[]>(parameters.size());
         for (Map.Entry<String, List<String>> entry : parameters.entrySet()) {
@@ -101,4 +134,14 @@ public class APIRequest extends HttpServletRequestWrapper {
 
     }
 
+    @Override
+    public String getRemoteHost() {
+        return this.remoteHost;
+    }
+
+    @Override
+    public String getRemoteAddr() {
+        return this.remoteAddr;
+    }
+
 }


[13/13] incubator-guacamole-client git commit: GUACAMOLE-47: Merge support for GUAC_CLIENT_HOSTNAME and GUAC_CLIENT_ADDRESS parameter tokens.

Posted by mj...@apache.org.
GUACAMOLE-47: Merge support for GUAC_CLIENT_HOSTNAME and GUAC_CLIENT_ADDRESS parameter tokens.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/0d650039
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/0d650039
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/0d650039

Branch: refs/heads/master
Commit: 0d6500396af67a398cbee68dabb50d76cd7c68e3
Parents: d8f9d26 013e10d
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Jan 28 10:50:26 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Jan 28 10:50:26 2017 -0800

----------------------------------------------------------------------
 .../apache/guacamole/token/StandardTokens.java  | 18 ++++++++++++++
 .../org/apache/guacamole/rest/APIRequest.java   | 26 ++++++++++++++++++++
 2 files changed, 44 insertions(+)
----------------------------------------------------------------------



[02/13] incubator-guacamole-client git commit: GUACAMOLE-47: Add imports needed for implementation of client token.

Posted by mj...@apache.org.
GUACAMOLE-47: Add imports needed for implementation of client token.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/3614aff4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/3614aff4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/3614aff4

Branch: refs/heads/master
Commit: 3614aff4d9719a4768b0e98b3c02b6e6635143ca
Parents: 797bb86
Author: Nick Couchman <ni...@yahoo.com>
Authored: Fri Jan 6 19:26:53 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Fri Jan 6 19:26:53 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/guacamole/token/StandardTokens.java    | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3614aff4/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
index 4bf4221..0dd4aed 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
@@ -22,6 +22,7 @@ package org.apache.guacamole.token;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import org.apache.guacamole.net.auth.Credentials;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Utility class which provides access to standardized token names, as well as


[12/13] incubator-guacamole-client git commit: GUACAMOLE-47: Correct language of remoteHost/remoteAddr comments; Fix style issues on comment lines.

Posted by mj...@apache.org.
GUACAMOLE-47: Correct language of remoteHost/remoteAddr comments; Fix style issues on comment lines.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/013e10d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/013e10d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/013e10d6

Branch: refs/heads/master
Commit: 013e10d61e2f67e777b434787592056120eb1a43
Parents: 20a61fc
Author: Nick Couchman <ni...@yahoo.com>
Authored: Sat Jan 28 13:42:51 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:42:51 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/guacamole/rest/APIRequest.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/013e10d6/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index ec977cc..9044b24 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -42,12 +42,12 @@ public class APIRequest extends HttpServletRequestWrapper {
     private final Map<String, String[]> parameters;
 
     /**
-     * The remote hostname that initiated the request.
+     * The hostname of the client that initiated the request.
      */
     private final String remoteHost;
 
     /**
-     * The remote ip address that initiated the request.
+     * The ip address of the client that initiated the request.
      */
     private final String remoteAddr;
 
@@ -68,10 +68,10 @@ public class APIRequest extends HttpServletRequestWrapper {
 
         super(request);
 
-        // Grab the remote host info.
+        // Grab the remote host info
         this.remoteHost = request.getRemoteHost();
 
-	// Grab the remote ip info.
+        // Grab the remote ip info
         this.remoteAddr = request.getRemoteAddr();
 
         // Copy parameters from given MultivaluedMap 


[09/13] incubator-guacamole-client git commit: GUACAMOLE-47: Remove unnecessary checks of getRemoteHost/getRemoteAddr.

Posted by mj...@apache.org.
GUACAMOLE-47: Remove unnecessary checks of getRemoteHost/getRemoteAddr.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/20a61fc8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/20a61fc8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/20a61fc8

Branch: refs/heads/master
Commit: 20a61fc84589f0dc4a2f3e8e37ed026f8fe40d8c
Parents: 3fadac6
Author: Nick Couchman <ni...@yahoo.com>
Authored: Sat Jan 28 13:10:49 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/guacamole/rest/APIRequest.java   | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/20a61fc8/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index bdef6f4..ec977cc 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -69,16 +69,10 @@ public class APIRequest extends HttpServletRequestWrapper {
         super(request);
 
         // Grab the remote host info.
-        if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
-            this.remoteHost = request.getRemoteHost();
-        else
-            this.remoteHost = null;
+        this.remoteHost = request.getRemoteHost();
 
 	// Grab the remote ip info.
-        if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty())
-            this.remoteAddr = request.getRemoteAddr();
-        else
-            this.remoteAddr = null;
+        this.remoteAddr = request.getRemoteAddr();
 
         // Copy parameters from given MultivaluedMap 
         this.parameters = new HashMap<String, String[]>(parameters.size());


[04/13] incubator-guacamole-client git commit: GUACAMOLE-47: Tweak internal variable names for tokens.

Posted by mj...@apache.org.
GUACAMOLE-47: Tweak internal variable names for tokens.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/b785fc20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b785fc20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b785fc20

Branch: refs/heads/master
Commit: b785fc208b080bb39c593775dd9b0487ed597b31
Parents: 962bec8
Author: Nick Couchman <ni...@yahoo.com>
Authored: Fri Jan 6 20:10:38 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:39:49 2017 -0500

----------------------------------------------------------------------
 .../org/apache/guacamole/token/StandardTokens.java    |  8 ++++----
 .../java/org/apache/guacamole/rest/APIRequest.java    | 14 ++++++--------
 2 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b785fc20/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
index 0902310..037e22c 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
@@ -45,12 +45,12 @@ public class StandardTokens {
     /**
      * The name of the client token added via addStandardTokens().
      */
-    public static final String CLIENT_HOST_TOKEN = "GUAC_REMHOST";
+    public static final String REMHOST_TOKEN = "GUAC_REMHOST";
 
     /**
      * The IP of the client token added via addStandardTokens().
      */
-    public static final String CLIENT_IP_TOKEN = "GUAC_REMIP";
+    public static final String REMIP_TOKEN = "GUAC_REMIP";
 
     /**
      * The name of the date token (server-local time) added via
@@ -129,8 +129,8 @@ public class StandardTokens {
         // Add client hostname and ip tokens
         HttpServletRequest request = credentials.getRequest();
         if (request != null) {
-            filter.setToken(CLIENT_HOST_TOKEN, request.getRemoteHost());
-            filter.setToken(CLIENT_IP_TOKEN, request.getRemoteAddr());
+            filter.setToken(REMHOST_TOKEN, request.getRemoteHost());
+            filter.setToken(REMIP_TOKEN, request.getRemoteAddr());
         }
 
         // Add any tokens which do not require credentials

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b785fc20/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 6a49c3e..c1c9612 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -69,23 +69,21 @@ public class APIRequest extends HttpServletRequestWrapper {
         super(request);
 
         // Try a few methods to get client info.
-        String clientHostname = "";
-        String clientAddress = "";
-        if(request.getHeader("X-Guacamole-Client-Hostname") != "") {
+        if(request.getHeader("X-Guacamole-Client-Hostname") != null && request.getHeader("X-Guacamole-Client-Hostname") != "") {
             this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
-        } else if(request.getHeader("X-Forwarded-For") != "") {
+        } else if(request.getHeader("X-Forwarded-For") != null && request.getHeader("X-Forwarded-For") != "") {
             this.remoteHost = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteHost() != "") {
+        } else if(request.getRemoteHost() != null && request.getRemoteHost() != "") {
             this.remoteHost = request.getRemoteHost();
         } else {
             this.remoteHost = "";
         }
 
-        if(request.getHeader("X-Guacamole-Client-IP") != "") {
+        if(request.getHeader("X-Guacamole-Client-IP") != null && request.getHeader("X-Guacamole-Client-IP") != "") {
             this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
-        } else if(request.getHeader("X-Forwarded-For") != "") {
+        } else if(request.getHeader("X-Forwarded-For") != null && request.getHeader("X-Forwarded-For") != "") {
             this.remoteAddr = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteAddr() != "") {
+        } else if(request.getRemoteHost() != null && request.getRemoteAddr() != "") {
             this.remoteAddr = request.getRemoteAddr();
         } else {
             this.remoteAddr = "";


[03/13] incubator-guacamole-client git commit: GUACAMOLE-47: Shorten the token length and change name.

Posted by mj...@apache.org.
GUACAMOLE-47: Shorten the token length and change name.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/962bec88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/962bec88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/962bec88

Branch: refs/heads/master
Commit: 962bec88068a692a4a94ba1a51a9dbb102b5a5c7
Parents: 3614aff
Author: Nick Couchman <ni...@yahoo.com>
Authored: Fri Jan 6 19:38:31 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Fri Jan 6 19:38:31 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/guacamole/token/StandardTokens.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/962bec88/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
index 0dd4aed..0902310 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
@@ -45,12 +45,12 @@ public class StandardTokens {
     /**
      * The name of the client token added via addStandardTokens().
      */
-    public static final String CLIENT_HOST_TOKEN = "GUAC_CLIENT_HOST";
+    public static final String CLIENT_HOST_TOKEN = "GUAC_REMHOST";
 
     /**
      * The IP of the client token added via addStandardTokens().
      */
-    public static final String CLIENT_IP_TOKEN = "GUAC_CLIENT_IP";
+    public static final String CLIENT_IP_TOKEN = "GUAC_REMIP";
 
     /**
      * The name of the date token (server-local time) added via


[06/13] incubator-guacamole-client git commit: GUACAMOLE-47: When using XFF header, just set hostname component to null.

Posted by mj...@apache.org.
GUACAMOLE-47: When using XFF header, just set hostname component to null.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/f08a66bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/f08a66bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/f08a66bb

Branch: refs/heads/master
Commit: f08a66bb7f49b064edce30f617fb1543acb19e6a
Parents: 44a197c
Author: Nick Couchman <ni...@yahoo.com>
Authored: Fri Jan 27 12:41:25 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/f08a66bb/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 0101d62..29c9402 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -72,7 +72,7 @@ public class APIRequest extends HttpServletRequestWrapper {
         if (request.getHeader("X-Guacamole-Client-Hostname") != null && !request.getHeader("X-Guacamole-Client-Hostname").isEmpty())
             this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
         else if (request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
-            this.remoteHost = request.getHeader("X-Forwarded-For");
+            this.remoteHost = null;
         else if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
             this.remoteHost = request.getRemoteHost();
         else


[07/13] incubator-guacamole-client git commit: GUACAMOLE-47: Remove XFF header code due to security concerns.

Posted by mj...@apache.org.
GUACAMOLE-47: Remove XFF header code due to security concerns.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/3fadac63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/3fadac63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/3fadac63

Branch: refs/heads/master
Commit: 3fadac632c1d98aa6071728ada5af024e8eede88
Parents: 00df0d7
Author: Nick Couchman <ni...@yahoo.com>
Authored: Sat Jan 28 12:58:53 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../main/java/org/apache/guacamole/rest/APIRequest.java  | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/3fadac63/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 57839a5..bdef6f4 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -68,17 +68,14 @@ public class APIRequest extends HttpServletRequestWrapper {
 
         super(request);
 
-        // Try a few methods to get client info.
-        if (request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
-            this.remoteHost = null;
-        else if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
+        // Grab the remote host info.
+        if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
             this.remoteHost = request.getRemoteHost();
         else
             this.remoteHost = null;
 
-        if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
-            this.remoteAddr = request.getHeader("X-Forwarded-For");
-        else if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty())
+	// Grab the remote ip info.
+        if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty())
             this.remoteAddr = request.getRemoteAddr();
         else
             this.remoteAddr = null;


[05/13] incubator-guacamole-client git commit: GUACAMOLE-47: Change new token names to something more descriptive.

Posted by mj...@apache.org.
GUACAMOLE-47: Change new token names to something more descriptive.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/44a197c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/44a197c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/44a197c7

Branch: refs/heads/master
Commit: 44a197c7627af96d79aa0efc37e8366bceebda02
Parents: ac08688
Author: Nick Couchman <ni...@yahoo.com>
Authored: Wed Jan 25 13:03:28 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/guacamole/token/StandardTokens.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/44a197c7/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
index 037e22c..9cb1f41 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
@@ -45,12 +45,12 @@ public class StandardTokens {
     /**
      * The name of the client token added via addStandardTokens().
      */
-    public static final String REMHOST_TOKEN = "GUAC_REMHOST";
+    public static final String REMHOST_TOKEN = "GUAC_CLIENT_HOSTNAME";
 
     /**
      * The IP of the client token added via addStandardTokens().
      */
-    public static final String REMIP_TOKEN = "GUAC_REMIP";
+    public static final String REMIP_TOKEN = "GUAC_CLIENT_ADDRESS";
 
     /**
      * The name of the date token (server-local time) added via


[08/13] incubator-guacamole-client git commit: GUACAMOLE-47: Fix checking for empty strings; Set tokens to null if nothing found.

Posted by mj...@apache.org.
GUACAMOLE-47: Fix checking for empty strings; Set tokens to null if nothing found.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/1b9f7c51
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/1b9f7c51
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/1b9f7c51

Branch: refs/heads/master
Commit: 1b9f7c51549e2e87a75e4f4a4b3c3ab145a58141
Parents: b785fc2
Author: Nick Couchman <ni...@yahoo.com>
Authored: Wed Jan 25 12:40:12 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../java/org/apache/guacamole/rest/APIRequest.java  | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/1b9f7c51/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index c1c9612..5ee31e1 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -69,24 +69,24 @@ public class APIRequest extends HttpServletRequestWrapper {
         super(request);
 
         // Try a few methods to get client info.
-        if(request.getHeader("X-Guacamole-Client-Hostname") != null && request.getHeader("X-Guacamole-Client-Hostname") != "") {
+        if(request.getHeader("X-Guacamole-Client-Hostname") != null && !request.getHeader("X-Guacamole-Client-Hostname").isEmpty()) {
             this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
-        } else if(request.getHeader("X-Forwarded-For") != null && request.getHeader("X-Forwarded-For") != "") {
+        } else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty()) {
             this.remoteHost = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteHost() != null && request.getRemoteHost() != "") {
+        } else if(request.getRemoteHost() != null && !request.getRemoteHost().isEmpty()) {
             this.remoteHost = request.getRemoteHost();
         } else {
-            this.remoteHost = "";
+            this.remoteHost = null;
         }
 
-        if(request.getHeader("X-Guacamole-Client-IP") != null && request.getHeader("X-Guacamole-Client-IP") != "") {
+        if(request.getHeader("X-Guacamole-Client-IP") != null && !request.getHeader("X-Guacamole-Client-IP").isEmpty()) {
             this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
-        } else if(request.getHeader("X-Forwarded-For") != null && request.getHeader("X-Forwarded-For") != "") {
+        } else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty()) {
             this.remoteAddr = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteHost() != null && request.getRemoteAddr() != "") {
+        } else if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty()) {
             this.remoteAddr = request.getRemoteAddr();
         } else {
-            this.remoteAddr = "";
+            this.remoteAddr = null;
         }
 
         // Copy parameters from given MultivaluedMap 


[11/13] incubator-guacamole-client git commit: GUACAMOLE-47: Fix code style issues.

Posted by mj...@apache.org.
GUACAMOLE-47: Fix code style issues.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/ac086889
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/ac086889
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/ac086889

Branch: refs/heads/master
Commit: ac08688996efe621cbd0ed347fa734745667a36f
Parents: 1b9f7c5
Author: Nick Couchman <ni...@yahoo.com>
Authored: Wed Jan 25 12:46:55 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../org/apache/guacamole/rest/APIRequest.java     | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/ac086889/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 5ee31e1..0101d62 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -69,25 +69,23 @@ public class APIRequest extends HttpServletRequestWrapper {
         super(request);
 
         // Try a few methods to get client info.
-        if(request.getHeader("X-Guacamole-Client-Hostname") != null && !request.getHeader("X-Guacamole-Client-Hostname").isEmpty()) {
+        if (request.getHeader("X-Guacamole-Client-Hostname") != null && !request.getHeader("X-Guacamole-Client-Hostname").isEmpty())
             this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
-        } else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty()) {
+        else if (request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
             this.remoteHost = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteHost() != null && !request.getRemoteHost().isEmpty()) {
+        else if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
             this.remoteHost = request.getRemoteHost();
-        } else {
+        else
             this.remoteHost = null;
-        }
 
-        if(request.getHeader("X-Guacamole-Client-IP") != null && !request.getHeader("X-Guacamole-Client-IP").isEmpty()) {
+        if (request.getHeader("X-Guacamole-Client-IP") != null && !request.getHeader("X-Guacamole-Client-IP").isEmpty())
             this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
-        } else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty()) {
+        else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
             this.remoteAddr = request.getHeader("X-Forwarded-For");
-        } else if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty()) {
+        else if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty())
             this.remoteAddr = request.getRemoteAddr();
-        } else {
+        else
             this.remoteAddr = null;
-        }
 
         // Copy parameters from given MultivaluedMap 
         this.parameters = new HashMap<String, String[]>(parameters.size());


[10/13] incubator-guacamole-client git commit: GUACAMOLE-47: Remove custom header code due to complexity & security concerns.

Posted by mj...@apache.org.
GUACAMOLE-47: Remove custom header code due to complexity & security concerns.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/00df0d75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/00df0d75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/00df0d75

Branch: refs/heads/master
Commit: 00df0d75ebc1eed173a6fc49c7142acc260181a5
Parents: f08a66b
Author: Nick Couchman <ni...@yahoo.com>
Authored: Sat Jan 28 08:23:32 2017 -0500
Committer: Nick Couchman <ni...@yahoo.com>
Committed: Sat Jan 28 13:40:09 2017 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/guacamole/rest/APIRequest.java  | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/00df0d75/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
index 29c9402..57839a5 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java
@@ -69,18 +69,14 @@ public class APIRequest extends HttpServletRequestWrapper {
         super(request);
 
         // Try a few methods to get client info.
-        if (request.getHeader("X-Guacamole-Client-Hostname") != null && !request.getHeader("X-Guacamole-Client-Hostname").isEmpty())
-            this.remoteHost = request.getHeader("X-Guacamole-Client-Hostname");
-        else if (request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
+        if (request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
             this.remoteHost = null;
         else if (request.getRemoteHost() != null && !request.getRemoteHost().isEmpty())
             this.remoteHost = request.getRemoteHost();
         else
             this.remoteHost = null;
 
-        if (request.getHeader("X-Guacamole-Client-IP") != null && !request.getHeader("X-Guacamole-Client-IP").isEmpty())
-            this.remoteAddr = request.getHeader("X-Guacamole-Client-IP");
-        else if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
+        if(request.getHeader("X-Forwarded-For") != null && !request.getHeader("X-Forwarded-For").isEmpty())
             this.remoteAddr = request.getHeader("X-Forwarded-For");
         else if(request.getRemoteHost() != null && !request.getRemoteAddr().isEmpty())
             this.remoteAddr = request.getRemoteAddr();