Skip to content

Commit

Permalink
Consider token num uses on lookup and show localized message on login…
Browse files Browse the repository at this point in the history
…ByAppRole exception.
  • Loading branch information
L2JE committed Nov 28, 2022
1 parent 788eb39 commit fee157d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ private String getVaultAuthToken() throws ConfigurationException, VaultException

} catch (VaultException e) {
throw new ConfigurationException(
String.format("Encountered error while authenticating with %s",
vaultAuthBackend)
String.format("Encountered error while authenticating with %s: %s", vaultAuthBackend, e.getLocalizedMessage())
);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ private boolean isDir(String key) {

protected void lookup(){
try {
long ttl = getVaultClient().auth().lookupSelf().getTTL();
if (ttl <= guaranteedTokenValidity) {
LookupResponse lookupSelf = getVaultClient().auth().lookupSelf();
if (lookupSelf.getTTL() <= guaranteedTokenValidity || lookupSelf.getNumUses() < 0) {
loginVault(clientProvider);
}
} catch (VaultException e) {
Expand Down

0 comments on commit fee157d

Please sign in to comment.