Skip to content

Commit 1e67d16

Browse files
authored
Added a method to reset Vault token manually (#44)
* Added a method to reset Vault token manually * Fixed linter
1 parent 9bf66d5 commit 1e67d16

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Source/VaultSharp.Extensions.Configuration/VaultChangeWatcher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public VaultChangeWatcher(IConfiguration configuration, ILogger? logger = null)
3232
}
3333

3434
this._logger = logger;
35-
35+
3636
this._configProviders = configurationRoot.Providers.OfType<VaultConfigurationProvider>().Where(p => p.ConfigurationSource.Options.ReloadOnChange).ToList() !;
3737
}
3838

Source/VaultSharp.Extensions.Configuration/VaultConfigurationProvider.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ public override void Load()
115115
}
116116
}
117117

118+
/// <summary>
119+
/// This will fetch the vault token again before the new operation.
120+
/// Use IConfiguration object: configurationRoot.Providers.OfType&lt;VaultConfigurationProvider&lt;().FirstOrDefault().ResetToken();
121+
/// See https://github.com/rajanadar/VaultSharp/blob/34ab400c2a295f4a81d97fc5d65f38509c7e0f05/README.md?plain=1#L92
122+
/// </summary>
123+
public void ResetToken() => this.vaultClient?.V1.Auth.ResetVaultToken();
124+
118125
private async Task<bool> LoadVaultDataAsync(IVaultClient vaultClient)
119126
{
120127
var hasChanges = false;

0 commit comments

Comments
 (0)