Package codes.grow.packages.vault
Class TokenRenewer
java.lang.Object
codes.grow.packages.vault.TokenRenewer
- All Implemented Interfaces:
AutoCloseable
Renews the client token in the background (
auth/token/renew-self at 2/3 of the TTL). When
the token cannot be renewed any more it logs in again (when a re-login method is set) or calls
onExpire once at expiry. Stopped by close() or VaultClient.close().-
Method Summary
-
Method Details
-
running
public boolean running()Returns whether the renewer is active.- Returns:
- true while renewing
-
expired
public boolean expired()Returns whetheronExpirefired.- Returns:
- true once expired
-
expiresAt
Returns the expiry of the current token.- Returns:
- the expiry, or empty when the token never expires
-
close
public void close()Stops renewing. Idempotent;onExpireis not called.- Specified by:
closein interfaceAutoCloseable
-