Skip to content

Commit a369762

Browse files
committed
GUACAMOLE-2030: Fix KSM static token mapping for per-user config.
1 parent c276c49 commit a369762

File tree

1 file changed

+7
-13
lines changed
  • extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret

1 file changed

+7
-13
lines changed

extensions/guacamole-vault/modules/guacamole-vault-ksm/src/main/java/org/apache/guacamole/vault/ksm/secret/KsmClient.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,13 @@ public Future<String> getSecret(
651651

652652
}
653653

654-
// Unfortunately, the notation parser within the Keeper SDK throws
655-
// plain Errors for retrieval failures ...
656-
catch (Error e) {
657-
logger.warn("Record \"{}\" does not exist.", notation);
654+
// Unfortunately, the notation parser within the Keeper SDK
655+
// only throws plain Errors and Exceptions.
656+
// There is no way to differentiate if an error is caused by
657+
// a non-existing record or a pure parse failure.
658+
catch (Error | Exception e) {
659+
logger.warn("Keeper notation \"{}\" could not be resolved "
660+
+ "to a record: {}", notation, e.getMessage());
658661
logger.debug("Retrieval of record by Keeper notation failed.", e);
659662

660663
// If the secret is not found, invoke the fallback function
@@ -663,15 +666,6 @@ public Future<String> getSecret(
663666

664667
return CompletableFuture.completedFuture(null);
665668
}
666-
667-
// ... and plain Exceptions for parse failures (no subclasses)
668-
catch (Exception e) {
669-
logger.warn("\"{}\" is not valid Keeper notation. Please check "
670-
+ "the documentation at {} for valid formatting.",
671-
notation, KEEPER_NOTATION_DOC_URL);
672-
logger.debug("Provided Keeper notation could not be parsed.", e);
673-
return CompletableFuture.completedFuture(null);
674-
}
675669
finally {
676670
cacheLock.readLock().unlock();
677671
}

0 commit comments

Comments
 (0)