public async Task <X509Certificate2> ConvertAsync(KeyVaultCertificateAttribute input, CancellationToken cancellationToken) { var client = new KeyVaultExtensionClient(keyVaultProperties: input).GetKeyVaultClient(); var certificateData = await this.GetCertificateData(client, input); return(new X509Certificate2(certificateData)); }
public async Task <string> ConvertAsync(KeyVaultSecretAttribute input, CancellationToken cancellationToken) { var client = new KeyVaultExtensionClient(keyVaultProperties: input).GetKeyVaultClient(); var secret = string.IsNullOrWhiteSpace(input.SecretVersion) ? await client.GetSecretAsync( vaultBaseUrl : KeyVaultHelpers.GetVaultBaseUrl(input.VaultName), secretName : input.SecretName) : await client.GetSecretAsync( vaultBaseUrl : KeyVaultHelpers.GetVaultBaseUrl(input.VaultName), secretName : input.SecretName, secretVersion : input.SecretVersion); return(secret.Value); }
public async Task <KeyResult> ConvertAsync(KeyVaultKeyAttribute input, CancellationToken cancellationToken) { var client = new KeyVaultExtensionClient(keyVaultProperties: input).GetKeyVaultClient(); var key = string.IsNullOrWhiteSpace(input.KeyVersion) ? await client.GetKeyAsync( vaultBaseUrl : KeyVaultHelpers.GetVaultBaseUrl(input.VaultName), keyName : input.KeyName) : await client.GetKeyAsync( vaultBaseUrl : KeyVaultHelpers.GetVaultBaseUrl(input.VaultName), keyName : input.KeyName, keyVersion : input.KeyVersion); return(new KeyResult { Key = key.Key }); }