From 9d7dff69958715e78535357e73e7d6cdc61529ce Mon Sep 17 00:00:00 2001 From: Theron Date: Tue, 6 Jun 2023 17:07:11 -0500 Subject: [PATCH] Add namespace field to VaultCAS JSON config --- cas/vaultcas/vaultcas.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cas/vaultcas/vaultcas.go b/cas/vaultcas/vaultcas.go index 8d3797f4..5908cb7d 100644 --- a/cas/vaultcas/vaultcas.go +++ b/cas/vaultcas/vaultcas.go @@ -37,6 +37,7 @@ type VaultOptions struct { PKIRoleEd25519 string `json:"pkiRoleEd25519,omitempty"` AuthType string `json:"authType,omitempty"` AuthMountPath string `json:"authMountPath,omitempty"` + Namespace string `json:"namespace,omitempty"` AuthOptions json.RawMessage `json:"authOptions,omitempty"` } @@ -90,6 +91,10 @@ func New(ctx context.Context, opts apiv1.Options) (*VaultCAS, error) { return nil, fmt.Errorf("unable to configure %s auth method: %w", vc.AuthType, err) } + if vc.Namespace != "" { + client.SetNamespace(vc.Namespace) + } + authInfo, err := client.Auth().Login(ctx, method) if err != nil { return nil, fmt.Errorf("unable to login to %s auth method: %w", vc.AuthType, err)