Provide distinct, documented, internal access to raw GuacamoleConfiguration within SimpleConnection.
While raw, internal access to the GuacamoleConfiguration was originally
present in older versions of SimpleConnection, this access was
undocumented and could result in unexpected behavior if the default
constructor was used, getConfiguration() was overridden, or
setConfiguration() was called.
@@ -52,7 +52,7 @@ public class SimpleConnection extends AbstractConnection {
/**
* Backing configuration, containing all sensitive information.
*/
- private GuacamoleConfiguration config;
+ private GuacamoleConfiguration fullConfig;
/**
* Creates a completely uninitialized SimpleConnection.
@@ -72,16 +72,33 @@ public class SimpleConnection extends AbstractConnection {
public SimpleConnection(String name, String identifier,
GuacamoleConfiguration config) {
- // Set name
- setName(name);
+ super.setName(name);
+ super.setIdentifier(identifier);
+ super.setConfiguration(config);
- // Set identifier
- setIdentifier(identifier);
+ this.fullConfig = config;
- // Set config
- setConfiguration(config);
- this.config = config;
+ }
+ /**
+ * Returns the GuacamoleConfiguration describing how to connect to this
+ * connection. Unlike the GuacamoleConfiguration returned by
+ * {@link #getConfiguration()}, which may omit or tokenize information,
+ * the GuacamoleConfiguration returned by this function contains the full
+ * configuration to be used to establish the connection.
+ *
+ * @return
+ * The full GuacamoleConfiguration describing how to connect to this
+ * connection, without any information omitted or tokenized.
+ */
+ protected GuacamoleConfiguration getFullConfiguration() {
+ return fullConfig;
+ }
+
+ @Override
+ public void setConfiguration(GuacamoleConfiguration config) {
+ super.setConfiguration(config);
+ this.fullConfig = config;
}
@Override
@@ -112,7 +129,7 @@ public class SimpleConnection extends AbstractConnection {
int port = proxyConfig.getPort();
// Apply tokens to config parameters
- GuacamoleConfiguration filteredConfig = new GuacamoleConfiguration(config);
+ GuacamoleConfiguration filteredConfig = new GuacamoleConfiguration(getFullConfiguration());
new TokenFilter(tokens).filterValues(filteredConfig.getParameters());
GuacamoleSocket socket;
