コード例 #1
0
        public static ClientState Load(ISecretStore store)
        {
            store.ValidateRequired("store");
            string xml = store.GetSecret(StateKeyName);

            if (String.IsNullOrEmpty(xml))
            {
                return(new ClientState());
            }

            return(HealthVaultClient.Serializer.FromXml <ClientState>(xml));
        }
コード例 #2
0
        public string PopulateSecrets(string value)
        {
            var   index = 0;
            Match match;

            do
            {
                match = _placeholder.Match(value, index);
                if (match.Success)
                {
                    var secretName  = match.Groups[1].Value;
                    var secretValue = _secretStore.GetSecret(secretName);
                    if (secretValue == null)
                    {
                        throw new ApplicationException($"The secret name '{secretName}' was not present in vault. Ensure that you have a local secrets.txt file in the src folder.");
                    }
                    value = value.Replace(match.Value, secretValue, StringComparison.InvariantCulture);
                    index = match.Index + 1;
                }
            } while (match.Success);

            return(value);
        }
        public static ClientState Load(ISecretStore store)
        {
            store.ValidateRequired("store");
            string xml = store.GetSecret(StateKeyName);
            if (String.IsNullOrEmpty(xml))
            {
                return new ClientState();
            }

            return HealthVaultClient.Serializer.FromXml<ClientState>(xml);
        }