Skip to content

Commit

Permalink
fix: add namespace to path and route construction (external-secrets#3632
Browse files Browse the repository at this point in the history
)

* fix: add namespace to path and route construction

Signed-off-by: Gergely Brautigam <[email protected]>

* fix: use the correct namespace while restoring from auth namespace

Signed-off-by: Gergely Brautigam <[email protected]>

* added fix suggestion from Gustavo

Signed-off-by: Gergely Brautigam <[email protected]>

---------

Signed-off-by: Gergely Brautigam <[email protected]>
  • Loading branch information
Skarlso authored Jul 21, 2024
1 parent 7f71b47 commit c078a88
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/provider/vault/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const (
// setAuth gets a new token using the configured mechanism.
// If there's already a valid token, does nothing.
func (c *client) setAuth(ctx context.Context, cfg *vault.Config) error {
if c.store.Namespace != nil { // set namespace before checking the need for AuthNamespace
c.client.SetNamespace(*c.store.Namespace)
}

// Switch to auth namespace if different from the provider namespace
restoreNamespace := c.useAuthNamespace(ctx)
defer restoreNamespace()
Expand Down Expand Up @@ -200,7 +204,7 @@ func revokeTokenIfValid(ctx context.Context, client util.Client) error {

func (c *client) useAuthNamespace(_ context.Context) func() {
ns := ""
if c.store.Namespace != nil {
if c.store != nil && c.store.Namespace != nil {
ns = *c.store.Namespace
}

Expand Down

0 comments on commit c078a88

Please sign in to comment.