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 2016/07/25 21:19:58 UTC
[4/6] incubator-guacamole-client git commit: GUACAMOLE-5: Store
SharedConnectionDefinition directly, rather than passing around its contents.
GUACAMOLE-5: Store SharedConnectionDefinition directly, rather than passing around its contents.
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/16fce293
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/16fce293
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/16fce293
Branch: refs/heads/master
Commit: 16fce2931f173a5ff1efc759f9e31c0769bba82e
Parents: d334aa9
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Jul 22 16:53:40 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Jul 24 19:51:17 2016 -0700
----------------------------------------------------------------------
.../auth/jdbc/sharing/SharedConnection.java | 29 +++++++++-----------
.../tunnel/AbstractGuacamoleTunnelService.java | 11 ++++----
.../jdbc/tunnel/GuacamoleTunnelService.java | 15 ++++------
3 files changed, 24 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/16fce293/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnection.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnection.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnection.java
index 70b8944..18862dc 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnection.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnection.java
@@ -26,9 +26,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.auth.jdbc.activeconnection.TrackedActiveConnection;
import org.apache.guacamole.auth.jdbc.connectiongroup.RootConnectionGroup;
-import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
import org.apache.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
import org.apache.guacamole.net.GuacamoleTunnel;
import org.apache.guacamole.net.auth.Connection;
@@ -64,15 +62,10 @@ public class SharedConnection implements Connection {
private SharedConnectionUser user;
/**
- * The active connection being shared.
+ * The SharedConnectionDefinition dictating the connection being shared and
+ * any associated restrictions.
*/
- private TrackedActiveConnection activeConnection;
-
- /**
- * The sharing profile which dictates the level of access provided to a user
- * of the shared connection.
- */
- private ModeledSharingProfile sharingProfile;
+ private SharedConnectionDefinition definition;
/**
* Creates a new SharedConnection which can be used to join the connection
@@ -88,8 +81,7 @@ public class SharedConnection implements Connection {
*/
public void init(SharedConnectionUser user, SharedConnectionDefinition definition) {
this.user = user;
- this.activeConnection = definition.getActiveConnection();
- this.sharingProfile = definition.getSharingProfile();
+ this.definition = definition;
}
@Override
@@ -104,7 +96,7 @@ public class SharedConnection implements Connection {
@Override
public String getName() {
- return sharingProfile.getName();
+ return definition.getSharingProfile().getName();
}
@Override
@@ -124,9 +116,15 @@ public class SharedConnection implements Connection {
@Override
public GuacamoleConfiguration getConfiguration() {
+
+ // Pull the connection being shared
+ Connection primaryConnection = definition.getActiveConnection().getConnection();
+
+ // Construct a skeletal configuration that exposes only the protocol in use
GuacamoleConfiguration config = new GuacamoleConfiguration();
- config.setProtocol(activeConnection.getConnection().getConfiguration().getProtocol());
+ config.setProtocol(primaryConnection.getConfiguration().getProtocol());
return config;
+
}
@Override
@@ -137,8 +135,7 @@ public class SharedConnection implements Connection {
@Override
public GuacamoleTunnel connect(GuacamoleClientInformation info)
throws GuacamoleException {
- return tunnelService.getGuacamoleTunnel(user, activeConnection,
- sharingProfile, info);
+ return tunnelService.getGuacamoleTunnel(user, definition, info);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/16fce293/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java
index d825631..b600a9f 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java
@@ -42,7 +42,6 @@ import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleResourceNotFoundException;
import org.apache.guacamole.GuacamoleSecurityException;
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
-import org.apache.guacamole.auth.jdbc.activeconnection.TrackedActiveConnection;
import org.apache.guacamole.auth.jdbc.connection.ConnectionMapper;
import org.apache.guacamole.environment.Environment;
import org.apache.guacamole.net.GuacamoleSocket;
@@ -56,6 +55,7 @@ import org.apache.guacamole.token.StandardTokens;
import org.apache.guacamole.token.TokenFilter;
import org.mybatis.guice.transactional.Transactional;
import org.apache.guacamole.auth.jdbc.connection.ConnectionParameterMapper;
+import org.apache.guacamole.auth.jdbc.sharing.SharedConnectionDefinition;
import org.apache.guacamole.auth.jdbc.sharing.SharedConnectionUser;
import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterMapper;
@@ -467,7 +467,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
// Verify that the connection ID is known
String connectionID = activeConnection.getConnectionID();
- if (!activeConnection.isActive() || connectionID == null)
+ if (connectionID == null)
throw new GuacamoleResourceNotFoundException("No existing connection to be joined.");
// Build configuration from the sharing profile and the ID of
@@ -681,13 +681,14 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
@Override
@Transactional
public GuacamoleTunnel getGuacamoleTunnel(SharedConnectionUser user,
- TrackedActiveConnection activeConnection,
- ModeledSharingProfile sharingProfile,
+ SharedConnectionDefinition definition,
GuacamoleClientInformation info)
throws GuacamoleException {
// Connect to shared connection
- return assignGuacamoleTunnel(new ActiveConnectionRecord(user, activeConnection, sharingProfile), info);
+ return assignGuacamoleTunnel(
+ new ActiveConnectionRecord(user, definition.getActiveConnection(),
+ definition.getSharingProfile()), info);
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/16fce293/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/GuacamoleTunnelService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/GuacamoleTunnelService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/GuacamoleTunnelService.java
index 6a00b2e..34965a7 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/GuacamoleTunnelService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/GuacamoleTunnelService.java
@@ -24,9 +24,8 @@ import org.apache.guacamole.auth.jdbc.user.AuthenticatedUser;
import org.apache.guacamole.auth.jdbc.connection.ModeledConnection;
import org.apache.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.auth.jdbc.activeconnection.TrackedActiveConnection;
+import org.apache.guacamole.auth.jdbc.sharing.SharedConnectionDefinition;
import org.apache.guacamole.auth.jdbc.sharing.SharedConnectionUser;
-import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
import org.apache.guacamole.net.GuacamoleTunnel;
import org.apache.guacamole.net.auth.Connection;
import org.apache.guacamole.net.auth.ConnectionGroup;
@@ -158,12 +157,9 @@ public interface GuacamoleTunnelService {
* @param user
* The user for whom the connection is being established.
*
- * @param activeConnection
- * The active connection the user is joining.
- *
- * @param sharingProfile
- * The sharing profile whose associated parameters dictate the level
- * of access granted to the user joining the connection.
+ * @param definition
+ * The SharedConnectionDefinition dictating the connection being shared
+ * and any associated restrictions.
*
* @param info
* Information describing the Guacamole client connecting to the given
@@ -178,8 +174,7 @@ public interface GuacamoleTunnelService {
* rules.
*/
GuacamoleTunnel getGuacamoleTunnel(SharedConnectionUser user,
- TrackedActiveConnection activeConnection,
- ModeledSharingProfile sharingProfile,
+ SharedConnectionDefinition definition,
GuacamoleClientInformation info)
throws GuacamoleException;