Ejemplo n.º 1
0
        private void ICredentialStoreTest(ICredentialStore credentialStore, string url, string username, string password)
        {
            try
            {
                TargetUri  uri        = new TargetUri(url);
                Credential writeCreds = new Credential(username, password);
                Credential readCreds  = null;

                credentialStore.WriteCredentials(uri, writeCreds);

                if ((readCreds = credentialStore.ReadCredentials(uri)) != null)
                {
                    Assert.AreEqual(writeCreds.Password, readCreds.Password, "Passwords did not match between written and read credentials");
                    Assert.AreEqual(writeCreds.Username, readCreds.Username, "Usernames did not match between written and read credentials");
                }
                else
                {
                    Assert.Fail("Failed to read credentials");
                }

                credentialStore.DeleteCredentials(uri);

                Assert.IsNull(readCreds = credentialStore.ReadCredentials(uri), "Deleted credentials were read back");
            }
            catch (Exception exception)
            {
                Assert.Fail(exception.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes credentials for target URI from the credential store
        /// </summary>
        /// <param name="targetUri">The URI of the target for which credentials are being deleted</param>
        public async Task <bool> DeleteCredentials(TargetUri targetUri)
        {
            ValidateTargetUri(targetUri);

            string targetName = GetTargetName(targetUri);

            return(Delete(targetName) &&
                   await _credentialCache.DeleteCredentials(targetUri));
        }
Ejemplo n.º 3
0
        public override async Task <bool> DeleteCredentials(TargetUri targetUri)
        {
            if (targetUri is null)
            {
                throw new ArgumentNullException(nameof(targetUri));
            }

            return(await _credentialStore.DeleteCredentials(targetUri));
        }
        /// <summary>
        /// Deletes credentials for target URI from the credential store
        /// </summary>
        /// <param name="targetUri">The URI of the target for which credentials are being deleted</param>
        public bool DeleteCredentials(TargetUri targetUri)
        {
            ValidateTargetUri(targetUri);

            string targetName = GetTargetName(targetUri);

            return(Delete(targetName) &&
                   _credentialCache.DeleteCredentials(targetUri));
        }
        /// <summary>
        /// Deletes credentials for target URI from the credential store
        /// </summary>
        /// <param name="targetUri">The URI of the target for which credentials are being deleted</param>
        public void DeleteCredentials(TargetUri targetUri)
        {
            ValidateTargetUri(targetUri);

            string targetName = GetTargetName(targetUri);

            Delete(targetName);

            _credentialCache.DeleteCredentials(targetUri);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Deletes credentials for target URI from the credential store
        /// </summary>
        /// <param name="targetUri">The URI of the target for which credentials are being deleted</param>
        public void DeleteCredentials(TargetUri targetUri)
        {
            ValidateTargetUri(targetUri);

            Trace.WriteLine("CredentialStore::DeleteCredentials");

            string targetName = this.GetTargetName(targetUri);

            this.Delete(targetName);

            _credentialCache.DeleteCredentials(targetUri);
        }
Ejemplo n.º 7
0
        public async Task <bool> DeleteCredentials(TargetUri targetUri)
        {
            if (targetUri is null)
            {
                throw new ArgumentNullException(nameof(targetUri));
            }

            string targetName = GetTargetName(targetUri);

            return(Delete(targetName) &&
                   await _credentialCache.DeleteCredentials(targetUri));
        }
        public async Task <bool> DeleteCredentials(TargetUri targetUri)
        {
#if DEBUG
            Trace.WriteLine($"targetUri: '{targetUri}': Key: '{GetKeyVaultKey(targetUri)}'");
#endif

            if (targetUri is null || string.IsNullOrEmpty(targetUri.Host))
            {
                throw new ArgumentNullException(nameof(targetUri));
            }

            string secret = null;
            try
            {
                secret = await KeyVaultHelper.KeyVault.DeleteSecretAsync(GetKeyVaultKey(targetUri));
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Exception deleting the secret from KeyVault:" + ex.Message);
            }

            return(string.IsNullOrEmpty(secret) &&
                   await _credentialCache.DeleteCredentials(targetUri));
        }
        /// <summary>
        /// Deletes `<see cref="Credential"/>` from the storage used by the authentication object.
        /// </summary>
        /// <param name="targetUri">The uniform resource indicator used to uniquely identify the credentials.</param>
        public override void DeleteCredentials(TargetUri targetUri)
        {
            BaseSecureStore.ValidateTargetUri(targetUri);

            _credentialStore.DeleteCredentials(targetUri);
        }
        private void ICredentialStoreTest(ICredentialStore credentialStore, string url, string username, string password)
        {
            try
            {
                Uri uri = new Uri(url, UriKind.Absolute);
                Credential writeCreds = new Credential(username, password);
                Credential readCreds = null;

                credentialStore.WriteCredentials(uri, writeCreds);

                if (credentialStore.ReadCredentials(uri, out readCreds))
                {
                    Assert.AreEqual(writeCreds.Password, readCreds.Password, "Passwords did not match between written and read credentials");
                    Assert.AreEqual(writeCreds.Username, readCreds.Username, "Usernames did not match between written and read credentials");
                }
                else
                {
                    Assert.Fail("Failed to read credentials");
                }

                credentialStore.DeleteCredentials(uri);

                Assert.IsFalse(credentialStore.ReadCredentials(uri, out readCreds), "Deleted credentials were read back");
            }
            catch (Exception exception)
            {
                Assert.Fail(exception.Message);
            }
        }
 public void DeleteCredentials(TargetUri targetUri) => LogWin32Exception("delete", () => store.DeleteCredentials(targetUri));
        /// <summary>
        /// Deletes `<see cref="Credential"/>` from the storage used by the authentication object.
        /// </summary>
        /// <param name="targetUri">The uniform resource indicator used to uniquely identify the credentials.</param>
        public override async Task <bool> DeleteCredentials(TargetUri targetUri)
        {
            BaseSecureStore.ValidateTargetUri(targetUri);

            return(await _credentialStore.DeleteCredentials(targetUri));
        }
 public void DeleteCredentials(TargetUri targetUri) =>
 store.DeleteCredentials(targetUri);