mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-5: Store share key within SharedConnectionDefinition.
This commit is contained in:
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -43,6 +43,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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user