From 5b69bf405d034258e1dd8ce34819add0dc2992ae Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Tue, 5 Jul 2022 17:59:44 +0000 Subject: [PATCH] GUACAMOLE-1629: Use TextField for KSM configuration since it's always one line. --- .../guacamole/vault/ksm/conf/KsmAttributeService.java | 4 ++-- .../apache/guacamole/vault/ksm/secret/KsmClient.java | 4 ++-- .../guacamole/vault/ksm/secret/KsmSecretService.java | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/conf/KsmAttributeService.java b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/conf/KsmAttributeService.java index ade0f97e9..83ab9c4a3 100644 --- a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/conf/KsmAttributeService.java +++ b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/conf/KsmAttributeService.java @@ -24,7 +24,7 @@ import java.util.Collection; import java.util.Collections; 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 com.google.inject.Singleton; @@ -47,7 +47,7 @@ public class KsmAttributeService implements VaultAttributeService { * per-connection-group basis. */ 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. diff --git a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java index be514ddfe..5572ef71d 100644 --- a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java +++ b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java @@ -215,7 +215,7 @@ public class KsmClient { cacheLock.writeLock().lock(); 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 if (currentTime - cacheTimestamp < CACHE_INTERVAL) return; @@ -258,7 +258,7 @@ public class KsmClient { }); - // Client has been refreshed + // Cache has been refreshed this.cacheTimestamp = System.currentTimeMillis(); } diff --git a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmSecretService.java b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmSecretService.java index 6e2c8f201..bea98d934 100644 --- a/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmSecretService.java +++ b/extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmSecretService.java @@ -84,14 +84,12 @@ public class KsmSecretService implements VaultSecretService { /** * 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 - * from the guacamole.properties config file. A distinct KSM client will exist for - * every KSM config. + * A distinct KSM client will exist for every KSM config. */ private final ConcurrentMap 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. * * @param ksmConfig @@ -100,11 +98,11 @@ public class KsmSecretService implements VaultSecretService { * this configuration. * * @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. * * @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) throws GuacamoleException {