< Summary

Class:Azure.Extensions.AspNetCore.Configuration.Secrets.KeyVaultSecretManager
Assembly:Azure.Extensions.AspNetCore.Configuration.Secrets
File(s):C:\Git\azure-sdk-for-net\sdk\extensions\Azure.Extensions.AspNetCore.Configuration.Secrets\src\KeyVaultSecretManager.cs
Covered lines:2
Uncovered lines:1
Coverable lines:3
Total lines:37
Line coverage:66.6% (2 of 3)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Instance()-0%100%
GetKey(...)-100%100%
Load(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\extensions\Azure.Extensions.AspNetCore.Configuration.Secrets\src\KeyVaultSecretManager.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Security.KeyVault.Secrets;
 5using Microsoft.Extensions.Configuration;
 6
 7namespace Azure.Extensions.AspNetCore.Configuration.Secrets
 8{
 9    /// <summary>
 10    /// Default implementation of <see cref="KeyVaultSecretManager"/> that loads all secrets
 11    /// and replaces '--' with ':" in key names.
 12    /// </summary>
 13    public class KeyVaultSecretManager
 14    {
 015        internal static KeyVaultSecretManager Instance { get; } = new KeyVaultSecretManager();
 16
 17        /// <summary>
 18        /// Checks if <see cref="KeyVaultSecret"/> value should be retrieved.
 19        /// </summary>
 20        /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param>
 21        /// <returns><code>true</code> if secrets value should be loaded, otherwise <code>false</code>.</returns>
 22        public virtual string GetKey(KeyVaultSecret secret)
 23        {
 3624            return secret.Name.Replace("--", ConfigurationPath.KeyDelimiter);
 25        }
 26
 27        /// <summary>
 28        /// Maps secret to a configuration key.
 29        /// </summary>
 30        /// <param name="secret">The <see cref="KeyVaultSecret"/> instance.</param>
 31        /// <returns>Configuration key name to store secret value.</returns>
 32        public virtual bool Load(SecretProperties secret)
 33        {
 4834            return true;
 35        }
 36    }
 37}

Methods/Properties

get_Instance()
GetKey(...)
Load(...)