java.lang.Object
io.github.jopenlibs.vault.api.LogicalUtilities
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddQualifierToPath(List<String> segments, int prefixPathDepth, String qualifier) Injects the supplied qualifier (either "data" or "metadata") into the second-from-the-root segment position, for a Vault path to be converted for use with a Version 2 secret engine.static StringadjustPathForDelete(String path, int prefixPathDepth, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret.static StringadjustPathForList(String path, int prefixPathDepth, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret.static StringadjustPathForReadOrWrite(String path, int prefixPathLength, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret.static StringadjustPathForVersionDelete(String path, int prefixPathDepth) When deleting secret versions, you must inject the path segment "delete" right after the lowest-level path segment.static StringadjustPathForVersionDestroy(String path, int prefixPathDepth) When destroying secret versions, you must inject the path segment "destroy" right after the lowest-level path segment.static StringadjustPathForVersionUnDelete(String path, int prefixPathDepth) When undeleting secret versions, you must inject the path segment "undelete" right after the lowest-level path segment.static JsonObjectjsonObjectToWriteFromEngineVersion(Logical.logicalOperations operation, JsonObject jsonObject) In version two, when writing a secret, the JSONObject must be nested with "data" as the key.
-
Method Details
-
addQualifierToPath
public static String addQualifierToPath(List<String> segments, int prefixPathDepth, String qualifier) Injects the supplied qualifier (either "data" or "metadata") into the second-from-the-root segment position, for a Vault path to be converted for use with a Version 2 secret engine.- Parameters:
segments- The Vault path split into segments.prefixPathDepth- Number of path elements in the prefix part of the path (the part before the qualifier)qualifier- The String to add to the path, based on the operation.- Returns:
- The final path with the needed qualifier.
-
adjustPathForReadOrWrite
public static String adjustPathForReadOrWrite(String path, int prefixPathLength, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret. In version 2 though, the path varies depending on the operation being performed. When reading or writing a secret, you must inject the path segment "data" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathLength- prefixPathLengthoperation- The operation being performed, e.g. readV2 or writeV1.- Returns:
- The Vault path mutated based on the operation.
-
adjustPathForList
public static String adjustPathForList(String path, int prefixPathDepth, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret. In version 2 though, the path varies depending on the operation being performed. When listing secrets available beneath a path, you must inject the path segment "metadata" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathDepth- prefixPathDepthoperation- The operation being performed, e.g. readV2 or writeV1.- Returns:
- The Vault path mutated based on the operation.
-
adjustPathForDelete
public static String adjustPathForDelete(String path, int prefixPathDepth, Logical.logicalOperations operation) In version 1 style secret engines, the same path is used for all CRUD operations on a secret. In version 2 though, the path varies depending on the operation being performed. When deleting secrets, you must inject the path segment "metadata" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathDepth- prefixPathDepthoperation- The operation being performed, e.g. readV2 or writeV1.- Returns:
- The modified path
-
adjustPathForVersionDelete
When deleting secret versions, you must inject the path segment "delete" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathDepth- prefixPathDepth- Returns:
- The modified path
-
adjustPathForVersionUnDelete
When undeleting secret versions, you must inject the path segment "undelete" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathDepth- prefixPathDepth- Returns:
- The path mutated depending on the operation.
-
adjustPathForVersionDestroy
When destroying secret versions, you must inject the path segment "destroy" right after the lowest-level path segment.- Parameters:
path- The Vault path to check or mutate, based on the operation.prefixPathDepth- prefixPathDepth- Returns:
- The path mutated depending on the operation.
-
jsonObjectToWriteFromEngineVersion
public static JsonObject jsonObjectToWriteFromEngineVersion(Logical.logicalOperations operation, JsonObject jsonObject) In version two, when writing a secret, the JSONObject must be nested with "data" as the key.- Parameters:
operation- The operation being performed, e.g. writeV1, or writeV2.jsonObject- The jsonObject that is going to be written.- Returns:
- This jsonObject mutated for the operation.
-