mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-524: Provide convenience constructor for TokenFilter which initializes the filter with provided tokens.
This commit is contained in:
@@ -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