You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2017/01/29 19:50:33 UTC
[1/3] incubator-guacamole-client git commit: GUACAMOLE-47: Correct
documentation of address/hostname token names.
Repository: incubator-guacamole-client
Updated Branches:
refs/heads/master 8462d6ba0 -> 257c160aa
GUACAMOLE-47: Correct documentation of address/hostname token names.
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/1ed73e6a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/1ed73e6a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/1ed73e6a
Branch: refs/heads/master
Commit: 1ed73e6a9778c321aefc4587c5bd96cb658a0291
Parents: 0d65003
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Jan 28 11:20:23 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Jan 28 11:20:23 2017 -0800
----------------------------------------------------------------------
.../org/apache/guacamole/token/StandardTokens.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/1ed73e6a/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 9cb1f41..2d0dd34 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
@@ -21,8 +21,8 @@ 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;
+import org.apache.guacamole.net.auth.Credentials;
/**
* Utility class which provides access to standardized token names, as well as
@@ -43,14 +43,14 @@ public class StandardTokens {
public static final String PASSWORD_TOKEN = "GUAC_PASSWORD";
/**
- * The name of the client token added via addStandardTokens().
+ * The name of the client hostname token added via addStandardTokens().
*/
- public static final String REMHOST_TOKEN = "GUAC_CLIENT_HOSTNAME";
+ public static final String CLIENT_HOSTNAME_TOKEN = "GUAC_CLIENT_HOSTNAME";
/**
- * The IP of the client token added via addStandardTokens().
+ * The name of the client address token added via addStandardTokens().
*/
- public static final String REMIP_TOKEN = "GUAC_CLIENT_ADDRESS";
+ public static final String CLIENT_ADDRESS_TOKEN = "GUAC_CLIENT_ADDRESS";
/**
* 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(REMHOST_TOKEN, request.getRemoteHost());
- filter.setToken(REMIP_TOKEN, request.getRemoteAddr());
+ filter.setToken(CLIENT_HOSTNAME_TOKEN, request.getRemoteHost());
+ filter.setToken(CLIENT_ADDRESS_TOKEN, request.getRemoteAddr());
}
// Add any tokens which do not require credentials
[3/3] incubator-guacamole-client git commit: GUACAMOLE-47: Merge
storage of remote address and hostname in credentials.
Posted by jm...@apache.org.
GUACAMOLE-47: Merge storage of remote address and hostname in credentials.
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/257c160a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/257c160a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/257c160a
Branch: refs/heads/master
Commit: 257c160aa81b0bfe295bb4a1a07ff6ce7eaa5f59
Parents: 8462d6b b336e26
Author: James Muehlner <ja...@guac-dev.org>
Authored: Sun Jan 29 11:49:38 2017 -0800
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Sun Jan 29 11:49:38 2017 -0800
----------------------------------------------------------------------
.../apache/guacamole/net/auth/Credentials.java | 65 ++++++++++++++++++++
.../apache/guacamole/token/StandardTokens.java | 24 ++++----
.../guacamole/rest/auth/TokenRESTService.java | 2 +
.../guacamole/rest/user/UserResource.java | 2 +
4 files changed, 82 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[2/3] incubator-guacamole-client git commit: GUACAMOLE-47: Store
remote address and hostname within Credentials.
Posted by jm...@apache.org.
GUACAMOLE-47: Store remote address and hostname within Credentials.
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/b336e26c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/b336e26c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/b336e26c
Branch: refs/heads/master
Commit: b336e26cb2e4cda2f309f5cf0c26875099dcdaa7
Parents: 1ed73e6
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Jan 28 11:23:31 2017 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Sat Jan 28 11:23:31 2017 -0800
----------------------------------------------------------------------
.../apache/guacamole/net/auth/Credentials.java | 65 ++++++++++++++++++++
.../apache/guacamole/token/StandardTokens.java | 16 ++---
.../guacamole/rest/auth/TokenRESTService.java | 2 +
.../guacamole/rest/user/UserResource.java | 2 +
4 files changed, 78 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b336e26c/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
----------------------------------------------------------------------
diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
index e6bb846..d9ea2d6 100644
--- a/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
+++ b/guacamole-ext/src/main/java/org/apache/guacamole/net/auth/Credentials.java
@@ -52,6 +52,19 @@ public class Credentials implements Serializable {
private String password;
/**
+ * The address of the client end of the connection which provided these
+ * credentials, if known.
+ */
+ private String remoteAddress;
+
+ /**
+ * The hostname or, if the hostname cannot be determined, the address of
+ * the client end of the connection which provided these credentials, if
+ * known.
+ */
+ private String remoteHostname;
+
+ /**
* The HttpServletRequest carrying additional credentials, if any.
*/
private transient HttpServletRequest request;
@@ -133,4 +146,56 @@ public class Credentials implements Serializable {
this.session = session;
}
+ /**
+ * Returns the address of the client end of the connection which provided
+ * these credentials, if known.
+ *
+ * @return
+ * The address of the client end of the connection which provided these
+ * credentials, or null if the address is not known.
+ */
+ public String getRemoteAddress() {
+ return remoteAddress;
+ }
+
+ /**
+ * Sets the address of the client end of the connection which provided
+ * these credentials.
+ *
+ * @param remoteAddress
+ * The address of the client end of the connection which provided these
+ * credentials, or null if the address is not known.
+ */
+ public void setRemoteAddress(String remoteAddress) {
+ this.remoteAddress = remoteAddress;
+ }
+
+ /**
+ * Returns the hostname of the client end of the connection which provided
+ * these credentials, if known. If the hostname of the client cannot be
+ * determined, but the address is known, the address may be returned
+ * instead.
+ *
+ * @return
+ * The hostname or address of the client end of the connection which
+ * provided these credentials, or null if the hostname is not known.
+ */
+ public String getRemoteHostname() {
+ return remoteHostname;
+ }
+
+ /**
+ * Sets the hostname of the client end of the connection which provided
+ * these credentials, if known. If the hostname of the client cannot be
+ * determined, but the address is known, the address may be specified
+ * instead.
+ *
+ * @param remoteHostname
+ * The hostname or address of the client end of the connection which
+ * provided these credentials, or null if the hostname is not known.
+ */
+ public void setRemoteHostname(String remoteHostname) {
+ this.remoteHostname = remoteHostname;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b336e26c/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 2d0dd34..04058fe 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
@@ -21,7 +21,6 @@ package org.apache.guacamole.token;
import java.text.SimpleDateFormat;
import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
import org.apache.guacamole.net.auth.Credentials;
/**
@@ -126,12 +125,15 @@ 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_HOSTNAME_TOKEN, request.getRemoteHost());
- filter.setToken(CLIENT_ADDRESS_TOKEN, request.getRemoteAddr());
- }
+ // Add client hostname token
+ String hostname = credentials.getRemoteHostname();
+ if (hostname != null)
+ filter.setToken(CLIENT_HOSTNAME_TOKEN, hostname);
+
+ // Add client address token
+ String address = credentials.getRemoteAddress();
+ if (address != null)
+ filter.setToken(CLIENT_ADDRESS_TOKEN, address);
// Add any tokens which do not require credentials
addStandardTokens(filter);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b336e26c/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java b/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java
index 14adeb5..2ba6459 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/auth/TokenRESTService.java
@@ -125,6 +125,8 @@ public class TokenRESTService {
credentials.setPassword(password);
credentials.setRequest(request);
credentials.setSession(request.getSession(true));
+ credentials.setRemoteAddress(request.getRemoteAddr());
+ credentials.setRemoteHostname(request.getRemoteHost());
return credentials;
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/b336e26c/guacamole/src/main/java/org/apache/guacamole/rest/user/UserResource.java
----------------------------------------------------------------------
diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/user/UserResource.java b/guacamole/src/main/java/org/apache/guacamole/rest/user/UserResource.java
index 7329a02..a0ca3ec 100644
--- a/guacamole/src/main/java/org/apache/guacamole/rest/user/UserResource.java
+++ b/guacamole/src/main/java/org/apache/guacamole/rest/user/UserResource.java
@@ -130,6 +130,8 @@ public class UserResource
credentials.setPassword(userPasswordUpdate.getOldPassword());
credentials.setRequest(request);
credentials.setSession(request.getSession(true));
+ credentials.setRemoteAddress(request.getRemoteAddr());
+ credentials.setRemoteHostname(request.getRemoteHost());
// Verify that the old password was correct
try {