mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
Merge 1.3.0 changes back to master.
This commit is contained in:
@@ -201,87 +201,52 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
||||
ModeledConnectionGroup connectionGroup);
|
||||
|
||||
/**
|
||||
* Returns a guacamole configuration containing the protocol and parameters
|
||||
* from the given connection. If the ID of an active connection is
|
||||
* provided, that connection will be joined instead of starting a new
|
||||
* primary connection. If tokens are used in the connection parameter
|
||||
* values, credentials from the given user will be substituted
|
||||
* appropriately.
|
||||
*
|
||||
* @param user
|
||||
* The user whose credentials should be used if necessary.
|
||||
* Returns a GuacamoleConfiguration which connects to the given connection.
|
||||
* If the ID of an active connection is provided, that active connection
|
||||
* will be joined rather than establishing an entirely new connection. If
|
||||
* a sharing profile is provided, the parameters associated with that
|
||||
* sharing profile will be used to define the access provided to the user
|
||||
* accessing the shared connection.
|
||||
*
|
||||
* @param connection
|
||||
* The connection whose protocol and parameters should be added to the
|
||||
* returned configuration.
|
||||
* The connection that the user is connecting to.
|
||||
*
|
||||
* @param connectionID
|
||||
* The ID of the active connection to be joined, as returned by guacd,
|
||||
* or null if a new primary connection should be established.
|
||||
*
|
||||
* @return
|
||||
* A GuacamoleConfiguration containing the protocol and parameters from
|
||||
* the given connection.
|
||||
*/
|
||||
private GuacamoleConfiguration getGuacamoleConfiguration(RemoteAuthenticatedUser user,
|
||||
ModeledConnection connection, String connectionID) {
|
||||
|
||||
// Generate configuration from available data
|
||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||
|
||||
// Join existing active connection, if any
|
||||
if (connectionID != null)
|
||||
config.setConnectionID(connectionID);
|
||||
|
||||
// Set protocol from connection if not joining an active connection
|
||||
else {
|
||||
ConnectionModel model = connection.getModel();
|
||||
config.setProtocol(model.getProtocol());
|
||||
}
|
||||
|
||||
// Set parameters from associated data
|
||||
Collection<ConnectionParameterModel> parameters = connectionParameterMapper.select(connection.getIdentifier());
|
||||
for (ConnectionParameterModel parameter : parameters)
|
||||
config.setParameter(parameter.getName(), parameter.getValue());
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a guacamole configuration which joins the active connection
|
||||
* having the given ID, using the provided sharing profile to restrict the
|
||||
* access provided to the user accessing the shared connection. If tokens
|
||||
* are used in the connection parameter values of the sharing profile,
|
||||
* credentials from the given user will be substituted appropriately.
|
||||
*
|
||||
* @param user
|
||||
* The user whose credentials should be used if necessary.
|
||||
* The ID of the active connection being joined, as provided by guacd
|
||||
* when the original connection was established, or null if a new
|
||||
* connection should be established instead.
|
||||
*
|
||||
* @param sharingProfile
|
||||
* The sharing profile whose associated parameters dictate the level
|
||||
* of access granted to the user joining the connection.
|
||||
*
|
||||
* @param connectionID
|
||||
* The ID of the connection being joined, as provided by guacd when the
|
||||
* original connection was established, or null if a new connection
|
||||
* should be created instead.
|
||||
* of access granted to the user joining the connection, or null if the
|
||||
* parameters associated with the connection should be used.
|
||||
*
|
||||
* @return
|
||||
* A GuacamoleConfiguration containing the protocol and parameters from
|
||||
* the given connection.
|
||||
* A GuacamoleConfiguration defining the requested, possibly shared
|
||||
* connection.
|
||||
*/
|
||||
private GuacamoleConfiguration getGuacamoleConfiguration(RemoteAuthenticatedUser user,
|
||||
ModeledSharingProfile sharingProfile, String connectionID) {
|
||||
private GuacamoleConfiguration getGuacamoleConfiguration(
|
||||
ModeledConnection connection, String connectionID,
|
||||
ModeledSharingProfile sharingProfile) {
|
||||
|
||||
ConnectionModel model = connection.getModel();
|
||||
|
||||
// Generate configuration from available data
|
||||
GuacamoleConfiguration config = new GuacamoleConfiguration();
|
||||
config.setProtocol(model.getProtocol());
|
||||
config.setConnectionID(connectionID);
|
||||
|
||||
// Set parameters from associated data
|
||||
Collection<SharingProfileParameterModel> parameters = sharingProfileParameterMapper.select(sharingProfile.getIdentifier());
|
||||
for (SharingProfileParameterModel parameter : parameters)
|
||||
config.setParameter(parameter.getName(), parameter.getValue());
|
||||
if (sharingProfile != null) {
|
||||
Collection<SharingProfileParameterModel> parameters = sharingProfileParameterMapper.select(sharingProfile.getIdentifier());
|
||||
for (SharingProfileParameterModel parameter : parameters)
|
||||
config.setParameter(parameter.getName(), parameter.getValue());
|
||||
}
|
||||
else {
|
||||
Collection<ConnectionParameterModel> parameters = connectionParameterMapper.select(connection.getIdentifier());
|
||||
for (ConnectionParameterModel parameter : parameters)
|
||||
config.setParameter(parameter.getName(), parameter.getValue());
|
||||
}
|
||||
|
||||
return config;
|
||||
|
||||
@@ -488,7 +453,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
||||
if (activeConnection.isPrimaryConnection()) {
|
||||
activeConnections.put(connection.getIdentifier(), activeConnection);
|
||||
activeConnectionGroups.put(connection.getParentIdentifier(), activeConnection);
|
||||
config = getGuacamoleConfiguration(activeConnection.getUser(), connection, activeConnection.getConnectionID());
|
||||
config = getGuacamoleConfiguration(connection, activeConnection.getConnectionID(), null);
|
||||
}
|
||||
|
||||
// If we ARE joining an active connection under the restrictions of
|
||||
@@ -502,8 +467,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
||||
|
||||
// Build configuration from the sharing profile and the ID of
|
||||
// the connection being joined
|
||||
config = getGuacamoleConfiguration(activeConnection.getUser(),
|
||||
activeConnection.getSharingProfile(), connectionID);
|
||||
config = getGuacamoleConfiguration(connection, connectionID, activeConnection.getSharingProfile());
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user