Example #1
0
 public async Task <byte[]> ConvertAsync(KeyVaultDecryptAttribute config, CancellationToken cancellationToken)
 {
     if (config is null || string.IsNullOrWhiteSpace(config?.KeyVaultUrl))
     {
         var esException = new KeyVaultBindingException("KeyVaultUrl cant be empty");
         _logger.LogError(esException, esException.Message);
         throw esException;
     }
     if (config.CreateKeyIfNotExistst is bool c && c && !string.IsNullOrWhiteSpace(config.KeyName) && config.KeyType is { })
Example #2
0
 public Task <IKeyVaultUtil> ConvertAsync(KeyVaultAttribute config, CancellationToken cancellationToken)
 {
     if (config is null || string.IsNullOrWhiteSpace(config?.KeyVaultUrl))
     {
         var esException = new KeyVaultBindingException("KeyVaultUrl cant be empty");
         _logger.LogError(esException, esException.Message);
         throw esException;
     }
     return(Task.FromResult <IKeyVaultUtil>(new KeyVaultUtil(config, _keyVaultClient)));
 }
 public async Task <SecretBundle> ConvertAsync(KeyVaultSecretAttribute config, CancellationToken cancellationToken)
 {
     if (string.IsNullOrWhiteSpace(config?.KeyVaultUrl))
     {
         var esException = new KeyVaultBindingException("KeyVaultUrl cant be empty");
         _logger.LogError(esException, esException.Message);
         throw esException;
     }
     return(await _keyVaultClient.GetSecretAsync(config.KeyVaultUrl, config.SecretName, cancellationToken));
 }