public async Task <string> GetValueAsync(string context, string key)
        {
            var ctx = ConvertJsonToContext(context);

            key = key ?? throw new SecureStoreException();
            var passwordKey = key.GetExistingMetadata();

            return(await ExecuteAzureKeyVaultOperation(
                       async() =>
            {
                IAzureKeyVaultClient keyVaultClient = _clientFactory.CreateClient(ctx);
                return await keyVaultClient.GetSecretAsync(passwordKey.VaultSecretName);
            },
                       "get"));
        }
        public async Task <Credential> GetCredentialsAsync(string context, string key)
        {
            var ctx = ConvertJsonToContext(context);

            key = key ?? throw new SecureStoreException();
            var passwordKey = key.GetExistingMetadata();

            var secret = await ExecuteAzureKeyVaultOperation(
                async() =>
            {
                IAzureKeyVaultClient keyVaultClient = _clientFactory.CreateClient(ctx);
                return(await keyVaultClient.GetSecretAsync(passwordKey.VaultSecretName));
            },
                "get");

            return(JsonConvert.DeserializeObject <Credential>(secret));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetBotSecretAsync(string id)
        {
            var secret = await _kvOperator.GetSecretAsync(id);

            return(Ok(secret));
        }