/// <summary> /// Initializes a new instance of the <see cref="KeyVaultCachedSecretProvider"/> class /// with standard generated <see cref="MemoryCache"/> and custom <paramref name="cacheConfiguration"/>. /// </summary> /// <param name="secretProvider">The inner Azure Key Vault secret provider to retrieve secrets.</param> /// <param name="cacheConfiguration">The custom caching configuration that defines how the cache works.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="secretProvider"/> or the <paramref name="cacheConfiguration"/> is <c>null</c>.</exception> public KeyVaultCachedSecretProvider(KeyVaultSecretProvider secretProvider, ICacheConfiguration cacheConfiguration) : base(secretProvider, cacheConfiguration) { Guard.NotNull(secretProvider, nameof(secretProvider), "Requires an Azure Key Vault secret provider to provide additional caching operations"); Guard.NotNull(cacheConfiguration, nameof(cacheConfiguration), "Requires a custom caching configuration instance for the cached Azure Key Vault secret provider"); _secretProvider = secretProvider; }
/// <summary> /// Initializes a new instance of the <see cref="KeyVaultCachedSecretProvider"/> class. /// </summary> /// <param name="secretProvider">The inner Azure Key Vault secret provider to provide secrets.</param> /// <param name="cacheConfiguration">The custom caching configuration that defines how the cache works.</param> /// <param name="memoryCache">The custom memory cache implementation that stores the cached secrets in memory.</param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="secretProvider"/>, <paramref name="cacheConfiguration"/>, or <paramref name="memoryCache"/> is <c>null</c>. /// </exception> public KeyVaultCachedSecretProvider(KeyVaultSecretProvider secretProvider, ICacheConfiguration cacheConfiguration, IMemoryCache memoryCache) : base(secretProvider, cacheConfiguration, memoryCache) { Guard.NotNull(secretProvider, nameof(secretProvider), "Requires an Azure Key Vault secret provider to provide additional caching operations"); Guard.NotNull(cacheConfiguration, nameof(cacheConfiguration), "Requires a custom caching configuration instance for the cached Azure Key Vault secret provider"); Guard.NotNull(memoryCache, nameof(memoryCache), "Requires a custom memory cache implementation to store the Azure Key Vault secrets in memory"); _secretProvider = secretProvider; }
/// <summary> /// Initializes a new instance of the <see cref="KeyVaultCachedSecretProvider"/> class /// with a standard generated <see cref="MemoryCache "/> and default cache duration <see cref="TimeSpan "/> of 5 minutes. /// </summary> /// <param name="secretProvider">The inner Azure Key Vault secret provider to provide secrets.</param> /// <exception cref="ArgumentNullException">Thrown when the <paramref name="secretProvider"/> is <c>null</c>.</exception> public KeyVaultCachedSecretProvider(KeyVaultSecretProvider secretProvider) : base(secretProvider) { Guard.NotNull(secretProvider, nameof(secretProvider), "Requires an Azure Key Vault secret provider to provide additional caching operations"); _secretProvider = secretProvider; }
/// <summary> /// Creating a new CachedSecretProvider with all required information /// </summary> /// <param name="secretProvider">The internal <see cref="ISecretProvider"/> used to retrieve the actual Secret Value, when not cached</param> /// <param name="cacheConfiguration">The <see cref="ICacheConfiguration"/> which defines how the cache works</param> /// <param name="memoryCache">A <see cref="IMemoryCache"/> implementation that can cache data in memory.</param> /// <exception cref="ArgumentNullException">The secretProvider and memoryCache parameters must not be null</exception> public KeyVaultCachedSecretProvider(KeyVaultSecretProvider secretProvider, ICacheConfiguration cacheConfiguration, IMemoryCache memoryCache) : base(secretProvider, cacheConfiguration, memoryCache) { Guard.NotNull(secretProvider, nameof(secretProvider), "Requires an Azure Key Vault secret provider to provide additional caching operations"); _secretProvider = secretProvider; }