Created
June 2, 2022 07:41
-
-
Save Mishco/9422229e473079e69259c20fd45932b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
public class CredentialsService { | |
private VaultTemplate vaultTemplate; | |
public void secureCredentials(String storagePlace, Credentials credentials) { | |
initVaultTemplate(); | |
vaultTemplate.write("kv/" + storagePlace, credentials); | |
} | |
public Credentials accessCredentials(String nameOfsecrets) { | |
initVaultTemplate(); | |
VaultResponseSupport<Credentials> response = vaultTemplate.read("kv/" + nameOfsecrets, Credentials.class); | |
return response.getData(); | |
} | |
public void deleteCredentials(String name) { | |
initVaultTemplate(); | |
vaultTemplate.delete("kv/" + name); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment