Esempio n. 1
0
 private static void AssertTaskSettings(KeyVaultTaskSettings settings)
 {
     ControlFlow.Assert(settings.VaultBaseUrl != null && settings.SecretName != null,
                        "settings.VaultBaseUrl != null && settings.SecretName != null");
     ControlFlow.Assert(settings.ClientSecret != null, "settings.ClientSecret != null");
     ControlFlow.Assert(settings.ClientId != null, "settings.ClientId != null");
 }
Esempio n. 2
0
        /// <summary><p>Load an Azure Key Vault to obtain secrets.</p></summary>
        public static KeyVault LoadVault(KeyVaultTaskSettings settings)
        {
            AssertTaskSettings(settings);
            ControlFlow.Assert(settings.VaultBaseUrl != null, "settings.VaultBaseUrl != null");

            return(CreateVault(settings));
        }
 public static KeyVaultTaskSettings Set(this KeyVaultTaskSettings keyVaultTaskSettings, KeyVaultSettings settings)
 {
     keyVaultTaskSettings              = keyVaultTaskSettings.NewInstance();
     keyVaultTaskSettings.ClientId     = settings.ClientId;
     keyVaultTaskSettings.ClientSecret = settings.Secret;
     keyVaultTaskSettings.VaultBaseUrl = settings.BaseUrl;
     return(keyVaultTaskSettings);
 }
 public static KeyVaultTaskSettings SetVaultBaseUrl(this KeyVaultTaskSettings keyVaultSettings, string vaultBaseUrl)
 {
     keyVaultSettings = keyVaultSettings.NewInstance();
     keyVaultSettings.VaultBaseUrl = vaultBaseUrl;
     return(keyVaultSettings);
 }
 public static KeyVaultTaskSettings SetSecretName(this KeyVaultTaskSettings keyVaultSettings, string secretName)
 {
     keyVaultSettings            = keyVaultSettings.NewInstance();
     keyVaultSettings.SecretName = secretName;
     return(keyVaultSettings);
 }
 public static KeyVaultTaskSettings SetClientSecret(this KeyVaultTaskSettings keyVaultSettings, string clientSecret)
 {
     keyVaultSettings = keyVaultSettings.NewInstance();
     keyVaultSettings.ClientSecret = clientSecret;
     return(keyVaultSettings);
 }
Esempio n. 7
0
 private static KeyVault CreateVault(KeyVaultTaskSettings settings)
 {
     return(new KeyVault(settings.ClientId, settings.ClientSecret, settings.VaultBaseUrl));
 }
Esempio n. 8
0
 /// <summary><p>Get a certificate bundle.</p></summary>
 public static KeyVaultCertificate GetCertificateBundle(KeyVaultTaskSettings settings, bool includeKey = true)
 {
     AssertTaskSettings(settings);
     return(GetTaskResult(CreateVault(settings).GetCertificate(settings.SecretName, includeKey)));
 }
Esempio n. 9
0
 /// <summary><p>>Get a certificate.</p></summary>
 public static KeyVaultKey GetKeyBundle(KeyVaultTaskSettings settings)
 {
     AssertTaskSettings(settings);
     return(GetTaskResult(CreateVault(settings).GetKey(settings.SecretName)));
 }
Esempio n. 10
0
 /// <summary><p>Get a secret.</p></summary>
 public static string GetSecret(KeyVaultTaskSettings settings)
 {
     AssertTaskSettings(settings);
     return(GetTaskResult(CreateVault(settings).GetSecret(settings.SecretName)));
 }