mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-524: Merge correct handling of parameter tokens within SimpleConnection
This commit is contained in:
@@ -113,8 +113,7 @@ public class SimpleConnection extends AbstractConnection {
|
|||||||
|
|
||||||
// Apply tokens to config parameters
|
// Apply tokens to config parameters
|
||||||
GuacamoleConfiguration filteredConfig = new GuacamoleConfiguration(config);
|
GuacamoleConfiguration filteredConfig = new GuacamoleConfiguration(config);
|
||||||
TokenFilter tokenFilter = new TokenFilter();
|
new TokenFilter(tokens).filterValues(filteredConfig.getParameters());
|
||||||
tokenFilter.filterValues(config.getParameters());
|
|
||||||
|
|
||||||
GuacamoleSocket socket;
|
GuacamoleSocket socket;
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package org.apache.guacamole.token;
|
package org.apache.guacamole.token;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@@ -68,7 +69,27 @@ public class TokenFilter {
|
|||||||
/**
|
/**
|
||||||
* The values of all known tokens.
|
* The values of all known tokens.
|
||||||
*/
|
*/
|
||||||
private final Map<String, String> tokenValues = new HashMap<String, String>();
|
private final Map<String, String> tokenValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new TokenFilter which has no associated tokens. Tokens must
|
||||||
|
* later be given using {@link #setToken(java.lang.String, java.lang.String)}
|
||||||
|
* or {@link #setTokens(java.util.Map)}.
|
||||||
|
*/
|
||||||
|
public TokenFilter() {
|
||||||
|
this(Collections.<String, String>emptyMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new TokenFilter which is initialized with the given token
|
||||||
|
* name/value pairs.
|
||||||
|
*
|
||||||
|
* @param tokenValues
|
||||||
|
* A map containing token names and their corresponding values.
|
||||||
|
*/
|
||||||
|
public TokenFilter(Map<String, String> tokenValues) {
|
||||||
|
this.tokenValues = new HashMap<>(tokenValues);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the token having the given name to the given value. Any existing
|
* Sets the token having the given name to the given value. Any existing
|
||||||
|
Reference in New Issue
Block a user