public class StandardHashiCorpVaultCommunicationService extends Object implements HashiCorpVaultCommunicationService
| Modifier and Type | Class and Description |
|---|---|
private static class |
StandardHashiCorpVaultCommunicationService.SecretData |
| Modifier and Type | Field and Description |
|---|---|
private Map<String,org.springframework.vault.core.VaultKeyValueOperations> |
keyValueOperationsMap |
private org.springframework.vault.core.VaultTransitOperations |
transitOperations |
private org.springframework.vault.core.VaultTemplate |
vaultTemplate |
| Constructor and Description |
|---|
StandardHashiCorpVaultCommunicationService(HashiCorpVaultProperties vaultProperties)
Creates a VaultCommunicationService that uses Spring Vault.
|
StandardHashiCorpVaultCommunicationService(org.springframework.core.env.PropertySource<?>... propertySources)
Creates a VaultCommunicationService that uses Spring Vault.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(String transitPath,
String cipherText)
Decrypts the given cipher text using Vault's Transit Secrets Engine.
|
String |
encrypt(String transitPath,
byte[] plainText)
Encrypts the given plaintext using Vault's Transit Secrets Engine.
|
Optional<String> |
readKeyValueSecret(String keyValuePath,
String secretKey)
Returns the value of the "value" secretKey from the secret at the path [keyValuePath]/[secretKey].
|
Map<String,String> |
readKeyValueSecretMap(String keyValuePath,
String key)
Reads a secret with multiple key/value pairs from Vault's unversioned Key/Value Secrets Engine.
|
void |
writeKeyValueSecret(String keyValuePath,
String secretKey,
String value)
Writes the value to the "value" secretKey of the secret with the path [keyValuePath]/[secretKey].
|
void |
writeKeyValueSecretMap(String keyValuePath,
String secretKey,
Map<String,String> keyValues)
Writes a secret with multiple key/value pairs using Vault's unversioned Key/Value Secrets Engine.
|
private final org.springframework.vault.core.VaultTemplate vaultTemplate
private final org.springframework.vault.core.VaultTransitOperations transitOperations
public StandardHashiCorpVaultCommunicationService(org.springframework.core.env.PropertySource<?>... propertySources)
throws HashiCorpVaultConfigurationException
propertySources - Property sources to configure the serviceHashiCorpVaultConfigurationException - If the configuration was invalidpublic StandardHashiCorpVaultCommunicationService(HashiCorpVaultProperties vaultProperties) throws HashiCorpVaultConfigurationException
vaultProperties - Properties to configure the serviceHashiCorpVaultConfigurationException - If the configuration was invalidpublic String encrypt(String transitPath, byte[] plainText)
HashiCorpVaultCommunicationServiceencrypt in interface HashiCorpVaultCommunicationServicetransitPath - The Vault path to use for the configured Transit Secrets EngineplainText - The plaintext to encryptpublic byte[] decrypt(String transitPath, String cipherText)
HashiCorpVaultCommunicationServicedecrypt in interface HashiCorpVaultCommunicationServicetransitPath - The Vault path to use for the configured Transit Secrets EnginecipherText - The cipher text to decryptpublic void writeKeyValueSecret(String keyValuePath, String secretKey, String value)
writeKeyValueSecret in interface HashiCorpVaultCommunicationServicekeyValuePath - The Vault path to use for the configured Key/Value v1 Secrets EnginesecretKey - The secret secretKeyvalue - The secret valuepublic Optional<String> readKeyValueSecret(String keyValuePath, String secretKey)
readKeyValueSecret in interface HashiCorpVaultCommunicationServicekeyValuePath - The Vault path to use for the configured Key/Value v1 Secrets EnginesecretKey - The secret secretKeypublic void writeKeyValueSecretMap(String keyValuePath, String secretKey, Map<String,String> keyValues)
HashiCorpVaultCommunicationServicewriteKeyValueSecretMap in interface HashiCorpVaultCommunicationServicekeyValuePath - The Vault path to use for the configured Key/Value v1 Secrets EnginekeyValues - A map from key to value for keys/values that should be stored in the secretpublic Map<String,String> readKeyValueSecretMap(String keyValuePath, String key)
HashiCorpVaultCommunicationServicereadKeyValueSecretMap in interface HashiCorpVaultCommunicationServicekeyValuePath - The Vault path to use for the configured Key/Value v1 Secrets Enginekey - The secret keyCopyright © 2022 Apache NiFi Project. All rights reserved.