public KeyVaultService(Guid clientId) { if (clientId == Guid.Empty) { throw new ArgumentException(nameof(clientId)); } _authenticationType = KeyVaultAuthenticationType.UserCredential; _clientId = clientId; _keyVaultClient = new KeyVaultClient(AuthenticationCallbackAsync); }
public IKeyVault Create(KeyVaultAuthenticationType authenticationType, string baseUri, string clientId, string authentication) { switch (authenticationType) { case KeyVaultAuthenticationType.Certificate: return(new CertificateKeyVault(baseUri, clientId, authentication)); case KeyVaultAuthenticationType.Secret: return(new ClientSecretKeyVault(baseUri, clientId, authentication)); default: throw new InvalidOperationException("KeyVaultAuthenticationType is not supported."); } }
public KeyVaultService(Guid clientId, X509Certificate2 certificate) { if (clientId == Guid.Empty) { throw new ArgumentException(nameof(clientId)); } if (certificate == null) { throw new ArgumentNullException(nameof(certificate)); } _authenticationType = KeyVaultAuthenticationType.ClientCertificate; _clientId = clientId; _assertionCert = new ClientAssertionCertificate(_clientId.ToString("D"), certificate); _keyVaultClient = new KeyVaultClient(AuthenticationCallbackAsync); }