Change hashicorpSecretData(require addr and key to be stored separately)

This commit is contained in:
chris-j-h 2019-07-10 15:42:14 +01:00
parent 871e722820
commit 2b79c5b964
2 changed files with 14 additions and 15 deletions

View File

@ -1,24 +1,23 @@
package vault
type hashicorpWalletConfig struct {
Client hashicorpClientConfig
Client hashicorpClientConfig
Secrets []hashicorpSecretData
}
type hashicorpClientConfig struct {
Url string `toml:",omitempty"`
Approle string `toml:",omitempty"`
CaCert string `toml:",omitempty"`
ClientCert string `toml:",omitempty"`
ClientKey string `toml:",omitempty"`
UseSecretCache bool `toml:",omitempty"`
Url string `toml:",omitempty"`
Approle string `toml:",omitempty"`
CaCert string `toml:",omitempty"`
ClientCert string `toml:",omitempty"`
ClientKey string `toml:",omitempty"`
StorePrivateKeys bool `toml:",omitempty"`
}
type hashicorpSecretData struct {
Name string `toml:",omitempty"`
SecretEngine string `toml:",omitempty"`
Version int `toml:",omitempty"`
AccountID string `toml:",omitempty"`
KeyID string `toml:",omitempty"`
AddressSecret string `toml:",omitempty"`
PrivateKeySecret string `toml:",omitempty"`
AddressSecretVersion int `toml:",omitempty"`
PrivateKeySecretVersion int `toml:",omitempty"`
SecretEngine string `toml:",omitempty"`
}

View File

@ -465,7 +465,7 @@ func TestVaultWallet_Open_Hashicorp_ErrAuthenticatingClient(t *testing.T) {
}
}
// Note: This is an integration test, as such the scope of the test is large, covering the VaultBackend, VaultWallet and HashicorpService
// Note: This is an integration test, as such the scope of the test is large. It covers the VaultBackend, vaultWallet and hashicorpService
func TestVaultWallet_Open_Hashicorp_SendsEventToBackendSubscribers(t *testing.T) {
if err := os.Setenv(api.EnvVaultToken, "mytoken"); err != nil {
t.Fatal(err)
@ -514,7 +514,7 @@ func TestVaultWallet_Close_Hashicorp_ReturnsStateToBeforeOpen(t *testing.T) {
config := hashicorpWalletConfig{
Client: hashicorpClientConfig{Url: "http://url:1"},
Secrets: []hashicorpSecretData{{Name: "secret1"}},
Secrets: []hashicorpSecretData{{AddressSecret: "addr1"}},
}
w, err := newHashicorpWallet(config, &event.Feed{})