guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [2/6] incubator-guacamole-client git commit: GUACAMOLE-5: Store share key within SharedConnectionDefinition.
Date Mon, 25 Jul 2016 21:19:56 GMT
GUACAMOLE-5: Store share key within SharedConnectionDefinition.

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/d334aa97
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/d334aa97
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/d334aa97

Branch: refs/heads/master
Commit: d334aa97d68d7e0bf1c0d9facd4c2ccc149c33e3
Parents: 868af6a
Author: Michael Jumper <mjumper@apache.org>
Authored: Fri Jul 22 16:49:05 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Sun Jul 24 19:51:17 2016 -0700

----------------------------------------------------------------------
 .../jdbc/sharing/ConnectionSharingService.java  |  4 ++--
 .../jdbc/sharing/HashSharedConnectionMap.java   |  8 +++++--
 .../sharing/SharedConnectionDefinition.java     | 22 +++++++++++++++++++-
 .../auth/jdbc/sharing/SharedConnectionMap.java  | 10 +++------
 4 files changed, 32 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d334aa97/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java
index 7b97f57..e05417a 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java
@@ -114,8 +114,8 @@ public class ConnectionSharingService {
 
         // Generate a share key for the requested connection
         String key = keyGenerator.getShareKey();
-        connectionMap.put(key, new SharedConnectionDefinition(activeConnection,
-                sharingProfile));
+        connectionMap.add(new SharedConnectionDefinition(activeConnection,
+                sharingProfile, key));
 
         // Return credentials defining a single expected parameter
         return new UserCredentials(SHARE_KEY,

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d334aa97/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/HashSharedConnectionMap.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/HashSharedConnectionMap.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/HashSharedConnectionMap.java
index e3dff02..ab898e4 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/HashSharedConnectionMap.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/HashSharedConnectionMap.java
@@ -48,8 +48,12 @@ public class HashSharedConnectionMap implements SharedConnectionMap {
     }
 
     @Override
-    public void put(String key, SharedConnectionDefinition definition) {
-        connectionMap.put(key, definition);
+    public void add(SharedConnectionDefinition definition) {
+
+        // Store definition by share key
+        String shareKey = definition.getShareKey();
+        connectionMap.put(shareKey, definition);
+
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d334aa97/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionDefinition.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionDefinition.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionDefinition.java
index 78ed62c..7e7566b 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionDefinition.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionDefinition.java
@@ -44,6 +44,11 @@ public class SharedConnectionDefinition {
     private final ModeledSharingProfile sharingProfile;
 
     /**
+     * The unique key with which a user may access the shared connection.
+     */
+    private final String shareKey;
+
+    /**
      * Creates a new SharedConnectionDefinition which describes an active
      * connection that can be joined, including the restrictions dictated by a
      * given sharing profile.
@@ -54,11 +59,15 @@ public class SharedConnectionDefinition {
      * @param sharingProfile
      *     A sharing profile whose associated parameters dictate the level of
      *     access provided to the shared connection.
+     *
+     * @param shareKey
+     *     The unique key with which a user may access the shared connection.
      */
     public SharedConnectionDefinition(TrackedActiveConnection activeConnection,
-            ModeledSharingProfile sharingProfile) {
+            ModeledSharingProfile sharingProfile, String shareKey) {
         this.activeConnection = activeConnection;
         this.sharingProfile = sharingProfile;
+        this.shareKey = shareKey;
     }
 
     /**
@@ -84,4 +93,15 @@ public class SharedConnectionDefinition {
         return sharingProfile;
     }
 
+    /**
+     * Returns the unique key with which a user may access the shared
+     * connection.
+     *
+     * @return
+     *     The unique key with which a user may access the shared connection.
+     */
+    public String getShareKey() {
+        return shareKey;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/d334aa97/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionMap.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionMap.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionMap.java
index 2df4b2d..29bce50 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionMap.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/SharedConnectionMap.java
@@ -28,19 +28,15 @@ package org.apache.guacamole.auth.jdbc.sharing;
 public interface SharedConnectionMap {
 
     /**
-     * Associates the given share key with a SharedConnectionDefinition,
+     * Stores the given SharedConnectionDefinition by its associated share key,
      * allowing the connection it describes to be accessed by users having the
      * share key.
      *
-     * @param key
-     *     The share key to use to share the connection described by the given
-     *     SharedConnectionDefinition.
-     *
      * @param definition
      *     The SharedConnectionDefinition describing the connection being
-     *     shared via the given share key.
+     *     shared.
      */
-    public void put(String key, SharedConnectionDefinition definition);
+    public void add(SharedConnectionDefinition definition);
 
     /**
      * Retrieves the connection definition associated with the given share key.


Mime
View raw message