| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using Azure.Core; |
| | 6 | | using Azure.Security.KeyVault.Secrets; |
| | 7 | | using Microsoft.Extensions.Configuration; |
| | 8 | |
|
| | 9 | | namespace Azure.Extensions.AspNetCore.Configuration.Secrets |
| | 10 | | { |
| | 11 | | /// <summary> |
| | 12 | | /// Options class used by the <see cref="AzureKeyVaultConfigurationExtensions"/>. |
| | 13 | | /// </summary> |
| | 14 | | internal class AzureKeyVaultConfigurationOptions |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Creates a new instance of <see cref="AzureKeyVaultConfigurationOptions"/>. |
| | 18 | | /// </summary> |
| 0 | 19 | | public AzureKeyVaultConfigurationOptions() |
| | 20 | | { |
| 0 | 21 | | Manager = KeyVaultSecretManager.Instance; |
| 0 | 22 | | } |
| | 23 | |
|
| | 24 | | /// <summary> |
| | 25 | | /// Creates a new instance of <see cref="AzureKeyVaultConfigurationOptions"/>. |
| | 26 | | /// </summary> |
| | 27 | | /// <param name="vaultUri">Azure Key Vault uri.</param> |
| | 28 | | /// <param name="credential">The <see cref="TokenCredential"/> to use for authentication.</param> |
| | 29 | | public AzureKeyVaultConfigurationOptions( |
| | 30 | | Uri vaultUri, |
| 0 | 31 | | TokenCredential credential) : this() |
| | 32 | | { |
| 0 | 33 | | Client = new SecretClient(vaultUri, credential); |
| 0 | 34 | | } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Gets or sets the <see cref="SecretClient"/> to use for retrieving values. |
| | 38 | | /// </summary> |
| 0 | 39 | | public SecretClient Client { get; set; } |
| | 40 | |
|
| | 41 | | /// <summary> |
| | 42 | | /// Gets or sets the <see cref="KeyVaultSecretManager"/> instance used to control secret loading. |
| | 43 | | /// </summary> |
| 0 | 44 | | public KeyVaultSecretManager Manager { get; set; } |
| | 45 | |
|
| | 46 | | /// <summary> |
| | 47 | | /// Gets or sets the timespan to wait between attempts at polling the Azure Key Vault for changes. <code>null</c |
| | 48 | | /// </summary> |
| 0 | 49 | | public TimeSpan? ReloadInterval { get; set; } |
| | 50 | | } |
| | 51 | | } |