GUACAMOLE-1629: Use TextField for KSM configuration since it's always one line.

This commit is contained in:
James Muehlner
2022-07-05 17:59:44 +00:00
parent fee2f8b416
commit 5b69bf405d
3 changed files with 8 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import org.apache.guacamole.form.Form; import org.apache.guacamole.form.Form;
import org.apache.guacamole.form.MultilineField; import org.apache.guacamole.form.TextField;
import org.apache.guacamole.vault.conf.VaultAttributeService; import org.apache.guacamole.vault.conf.VaultAttributeService;
import com.google.inject.Singleton; import com.google.inject.Singleton;
@@ -47,7 +47,7 @@ public class KsmAttributeService implements VaultAttributeService {
* per-connection-group basis. * per-connection-group basis.
*/ */
public static final Form KSM_CONFIGURATION_FORM = new Form("ksm-config", public static final Form KSM_CONFIGURATION_FORM = new Form("ksm-config",
Arrays.asList(new MultilineField(KSM_CONFIGURATION_ATTRIBUTE))); Arrays.asList(new TextField(KSM_CONFIGURATION_ATTRIBUTE)));
/** /**
* All KSM-specific connection group attributes, organized by form. * All KSM-specific connection group attributes, organized by form.

View File

@@ -215,7 +215,7 @@ public class KsmClient {
cacheLock.writeLock().lock(); cacheLock.writeLock().lock();
try { try {
// Client may have been updated since the read-only check. Re-verify // Cache may have been updated since the read-only check. Re-verify
// that the cache has expired before continuing with a full refresh // that the cache has expired before continuing with a full refresh
if (currentTime - cacheTimestamp < CACHE_INTERVAL) if (currentTime - cacheTimestamp < CACHE_INTERVAL)
return; return;
@@ -258,7 +258,7 @@ public class KsmClient {
}); });
// Client has been refreshed // Cache has been refreshed
this.cacheTimestamp = System.currentTimeMillis(); this.cacheTimestamp = System.currentTimeMillis();
} }

View File

@@ -84,14 +84,12 @@ public class KsmSecretService implements VaultSecretService {
/** /**
* A map of base-64 encoded JSON KSM config blobs to associated KSM client instances. * A map of base-64 encoded JSON KSM config blobs to associated KSM client instances.
* The `null` entry in this Map is associated with the KSM configuration parsed * A distinct KSM client will exist for every KSM config.
* from the guacamole.properties config file. A distinct KSM client will exist for
* every KSM config.
*/ */
private final ConcurrentMap<String, KsmClient> ksmClientMap = new ConcurrentHashMap<>(); private final ConcurrentMap<String, KsmClient> ksmClientMap = new ConcurrentHashMap<>();
/** /**
* Create and return a KSM cache for the provided KSM config if not already * Create and return a KSM client for the provided KSM config if not already
* present in the cache map, otherwise return the existing cache entry. * present in the cache map, otherwise return the existing cache entry.
* *
* @param ksmConfig * @param ksmConfig
@@ -100,11 +98,11 @@ public class KsmSecretService implements VaultSecretService {
* this configuration. * this configuration.
* *
* @return * @return
* A KSM cache for the provided KSM config if not already present in the * A KSM client for the provided KSM config if not already present in the
* cache map, otherwise the existing cache entry. * cache map, otherwise the existing cache entry.
* *
* @throws GuacamoleException * @throws GuacamoleException
* If an error occurs while creating the KSM cache. * If an error occurs while creating the KSM client.
*/ */
private KsmClient getClient(@Nonnull String ksmConfig) private KsmClient getClient(@Nonnull String ksmConfig)
throws GuacamoleException { throws GuacamoleException {