mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1218: Merge add support for parameter tokens in guacamole-auth-json
This commit is contained in:
@@ -151,14 +151,20 @@ For example, if you have a file called `auth.json` containing the following:
|
||||
"protocol" : "rdp",
|
||||
"parameters" : {
|
||||
"hostname" : "10.10.209.63",
|
||||
"port" : "3389"
|
||||
"port" : "3389",
|
||||
"ignore-cert": "true",
|
||||
"recording-path": "/recordings",
|
||||
"recording-name": "My-Connection-${GUAC_USERNAME}-${GUAC_DATE}-${GUAC_TIME}"
|
||||
}
|
||||
},
|
||||
"My OTHER Connection" : {
|
||||
"protocol" : "rdp",
|
||||
"parameters" : {
|
||||
"hostname" : "10.10.209.64",
|
||||
"port" : "3389"
|
||||
"port" : "3389",
|
||||
"ignore-cert": "true",
|
||||
"recording-path": "/recordings",
|
||||
"recording-name": "My-OTHER-Connection-${GUAC_USERNAME}-${GUAC_DATE}-${GUAC_TIME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,17 +176,22 @@ and you run:
|
||||
|
||||
You will receive the following output:
|
||||
|
||||
le2Ug6YIo4perD2GV17QtWvOdfSemVDDtCOdRYJlbdUf3fhN+63LpQa1RDkzU7Zc
|
||||
DW3+OtyTCBGQ7OLO+HpG6pHNom76BXpmnHSRx1UdQ3WVZelPUXEDzxe74aN6DUP9
|
||||
G9isXhBMdLUhZwEJf4k4Gpzt9MHAH5PufSKq3DO1UHnrRjdGbKKddug2BcuDrwJM
|
||||
UJf1tRX9CAEC11/gWEwrHDOhH/abeyeDyElbaEG/oOY8EdoFNYgUsjI2x31OpCuB
|
||||
sEv7FOFafL05wEoIFv0/pPft0DHk7GuvHBBCqXuK98yMEo3d0zD5D+IsOY8Rmm1+
|
||||
0CoWkX22mqyRQMFS2fTp/fClCN4QLb0aNn+unweTimd2SXN9cjREmZknXf7Tj8oU
|
||||
/FNXc37i0HEfG5aVgp5znMCwwRAOFnFhLqG3K2yaTRE+hLNBxlt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FN6AFhn8GIkMRRrjuevfZ+q9
|
||||
enWN14s24vt5OVg69DljzALobUNKUXFx69SR8EpSBvUcKq8s/OgbDpFvKbwsDY57
|
||||
HGT4T0CuRIA0TGUI075uerKBNApVhuBA1BmWJIrI4JXw5MuX6pdBe+MYccO3vfo+
|
||||
/frazj8rHdkDa/IbueMbvq+1ozV2+UuxrbaTrV2i4jSRgd74U0QzOh9e8Q0i7vOi
|
||||
l3hnIfOfg+v1oULmZmJSeiAYWxeGvPptp+n7rNFqHGM=
|
||||
|
||||
The resulting base64 data above, if submitted using the `data` parameter to
|
||||
Guacamole, will authenticate a user and grant them access to the connections
|
||||
|
@@ -43,6 +43,7 @@ import org.apache.guacamole.net.auth.GuacamoleProxyConfiguration;
|
||||
import org.apache.guacamole.protocol.ConfiguredGuacamoleSocket;
|
||||
import org.apache.guacamole.protocol.GuacamoleClientInformation;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
import org.apache.guacamole.token.TokenFilter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -166,7 +167,7 @@ public class ConnectionService {
|
||||
* connect is denied.
|
||||
*/
|
||||
public GuacamoleTunnel connect(UserData.Connection connection,
|
||||
GuacamoleClientInformation info) throws GuacamoleException {
|
||||
GuacamoleClientInformation info, Map<String, String> tokens) throws GuacamoleException {
|
||||
|
||||
// Retrieve proxy configuration from environment
|
||||
GuacamoleProxyConfiguration proxyConfig = environment.getDefaultGuacamoleProxyConfiguration();
|
||||
@@ -176,14 +177,17 @@ public class ConnectionService {
|
||||
int port = proxyConfig.getPort();
|
||||
|
||||
// Generate and verify connection configuration
|
||||
GuacamoleConfiguration config = getConfiguration(connection);
|
||||
if (config == null) {
|
||||
GuacamoleConfiguration filteredConfig = getConfiguration(connection);
|
||||
if (filteredConfig == null) {
|
||||
logger.debug("Configuration for connection could not be "
|
||||
+ "generated. Perhaps the connection being joined is not "
|
||||
+ "active?");
|
||||
throw new GuacamoleResourceNotFoundException("No such connection");
|
||||
}
|
||||
|
||||
// Apply tokens to config parameters
|
||||
new TokenFilter(tokens).filterValues(filteredConfig.getParameters());
|
||||
|
||||
// Determine socket type based on required encryption method
|
||||
final ConfiguredGuacamoleSocket socket;
|
||||
switch (proxyConfig.getEncryptionMethod()) {
|
||||
@@ -192,7 +196,7 @@ public class ConnectionService {
|
||||
case SSL:
|
||||
socket = new ConfiguredGuacamoleSocket(
|
||||
new SSLGuacamoleSocket(hostname, port),
|
||||
config, info
|
||||
filteredConfig, info
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -200,7 +204,7 @@ public class ConnectionService {
|
||||
case NONE:
|
||||
socket = new ConfiguredGuacamoleSocket(
|
||||
new InetGuacamoleSocket(hostname, port),
|
||||
config, info
|
||||
filteredConfig, info
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -277,7 +281,7 @@ public class ConnectionService {
|
||||
|
||||
// Track tunnels which join connections, such that they can be
|
||||
// automatically closed when the joined connection closes
|
||||
String joinedConnection = config.getConnectionID();
|
||||
String joinedConnection = filteredConfig.getConnectionID();
|
||||
if (joinedConnection != null) {
|
||||
|
||||
// Track shadower of joined connection if possible
|
||||
|
@@ -180,7 +180,7 @@ public class UserDataConnection implements Connection {
|
||||
}
|
||||
|
||||
// Perform connection operation
|
||||
return connectionService.connect(connection, info);
|
||||
return connectionService.connect(connection, info, tokens);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user