Pete Whitehead
Pete Whitehead

Reputation: 178

How do I determine the TTL of the Vault token the VaultClient acquires

I'm currently handling the TTL expiring like this:

Secret v2Secret; try { v2Secret = await this.vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(vaultPath).ConfigureAwait(false); } catch (VaultApiException e) { this.vaultClient.V1.Auth.ResetVaultToken(); v2Secret = await this.vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync(vaultPath).ConfigureAwait(false); }

Is there a way for me to check the TTL the vaultClient has before I make the first ReadSecretAsync call?

Upvotes: 0

Views: 591

Answers (1)

Raja Nadar
Raja Nadar

Reputation: 9499

The docs were missing on the VaultSharp methods that allow this. VaultSharp supports 2 ways to find TTL of a token.

  1. A LookupToken api where you can explicitly pass in any Vault-Token.
  2. Or a LookupSelf API, where the implicit current vault token info will be returned.

I have added the docs for it. Please refer to

https://github.com/rajanadar/VaultSharp/blob/master/README.md#token-lookup-any-token

and

https://github.com/rajanadar/VaultSharp/blob/master/README.md#token-lookup-calling-token

Upvotes: 0

Related Questions