diff options
author | Mike Crute <mike@crute.us> | 2022-12-23 17:14:06 -0800 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2022-12-23 17:14:06 -0800 |
commit | 685da24d55cb12e1f8d78a079cb7911424f6ddd4 (patch) | |
tree | b9154e9c99496c1f91a05857bdca92ae9b68d5fe | |
parent | 4edb5a7640b50993bf967916e61dcfd8d4306d3b (diff) | |
download | golib-685da24d55cb12e1f8d78a079cb7911424f6ddd4.tar.bz2 golib-685da24d55cb12e1f8d78a079cb7911424f6ddd4.tar.xz golib-685da24d55cb12e1f8d78a079cb7911424f6ddd4.zip |
secrets: support returning Vault token
-rw-r--r-- | secrets/vault_client.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/secrets/vault_client.go b/secrets/vault_client.go index 3466f48..ce26dbe 100644 --- a/secrets/vault_client.go +++ b/secrets/vault_client.go | |||
@@ -222,6 +222,14 @@ func (c *VaultClient) Authenticate(ctx context.Context) error { | |||
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | // VaultToken is not part of the official API but is exposed for | ||
226 | // clients that need to gain access to this for some reason. There are | ||
227 | // no compatibility guarantees with this method and it's use limits | ||
228 | // portability. | ||
229 | func (c *VaultClient) VaultToken() string { | ||
230 | return c.client.Token() | ||
231 | } | ||
232 | |||
225 | func (c *VaultClient) authToken(ctx context.Context) error { | 233 | func (c *VaultClient) authToken(ctx context.Context) error { |
226 | if c.client.Token() == "" { | 234 | if c.client.Token() == "" { |
227 | return fmt.Errorf("Authenticate: unable to authenticate, neither token nor approle provided") | 235 | return fmt.Errorf("Authenticate: unable to authenticate, neither token nor approle provided") |