mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +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
|
// Generate a share key for the requested connection
|
||||||
String key = keyGenerator.getShareKey();
|
String key = keyGenerator.getShareKey();
|
||||||
connectionMap.put(key, new SharedConnectionDefinition(activeConnection,
|
connectionMap.add(new SharedConnectionDefinition(activeConnection,
|
||||||
sharingProfile));
|
sharingProfile, key));
|
||||||
|
|
||||||
// Return credentials defining a single expected parameter
|
// Return credentials defining a single expected parameter
|
||||||
return new UserCredentials(SHARE_KEY,
|
return new UserCredentials(SHARE_KEY,
|
||||||
|
@@ -48,8 +48,12 @@ public class HashSharedConnectionMap implements SharedConnectionMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void put(String key, SharedConnectionDefinition definition) {
|
public void add(SharedConnectionDefinition definition) {
|
||||||
connectionMap.put(key, definition);
|
|
||||||
|
// Store definition by share key
|
||||||
|
String shareKey = definition.getShareKey();
|
||||||
|
connectionMap.put(shareKey, definition);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -43,6 +43,11 @@ public class SharedConnectionDefinition {
|
|||||||
*/
|
*/
|
||||||
private final ModeledSharingProfile sharingProfile;
|
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
|
* Creates a new SharedConnectionDefinition which describes an active
|
||||||
* connection that can be joined, including the restrictions dictated by a
|
* connection that can be joined, including the restrictions dictated by a
|
||||||
@@ -54,11 +59,15 @@ public class SharedConnectionDefinition {
|
|||||||
* @param sharingProfile
|
* @param sharingProfile
|
||||||
* A sharing profile whose associated parameters dictate the level of
|
* A sharing profile whose associated parameters dictate the level of
|
||||||
* access provided to the shared connection.
|
* access provided to the shared connection.
|
||||||
|
*
|
||||||
|
* @param shareKey
|
||||||
|
* The unique key with which a user may access the shared connection.
|
||||||
*/
|
*/
|
||||||
public SharedConnectionDefinition(TrackedActiveConnection activeConnection,
|
public SharedConnectionDefinition(TrackedActiveConnection activeConnection,
|
||||||
ModeledSharingProfile sharingProfile) {
|
ModeledSharingProfile sharingProfile, String shareKey) {
|
||||||
this.activeConnection = activeConnection;
|
this.activeConnection = activeConnection;
|
||||||
this.sharingProfile = sharingProfile;
|
this.sharingProfile = sharingProfile;
|
||||||
|
this.shareKey = shareKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,4 +93,15 @@ public class SharedConnectionDefinition {
|
|||||||
return sharingProfile;
|
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 {
|
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
|
* allowing the connection it describes to be accessed by users having the
|
||||||
* share key.
|
* share key.
|
||||||
*
|
*
|
||||||
* @param key
|
|
||||||
* The share key to use to share the connection described by the given
|
|
||||||
* SharedConnectionDefinition.
|
|
||||||
*
|
|
||||||
* @param definition
|
* @param definition
|
||||||
* The SharedConnectionDefinition describing the connection being
|
* 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.
|
* Retrieves the connection definition associated with the given share key.
|
||||||
|
Reference in New Issue
Block a user