예제 #1
0
    public void DeleteCredential()
    {
        using var credential = new CredentialManagement.Credential
              {
                  Target          = RaceControlF1TV,
                  Type            = CredentialType.Generic,
                  PersistanceType = PersistanceType.LocalComputer
              };

        if (credential.Delete())
        {
            _logger.Info("Credentials deleted from store.");
        }
        else
        {
            _logger.Warn("Credentials not deleted from store.");
        }
    }
예제 #2
0
        public bool DeleteCredential()
        {
            _logger.Info("Deleting credentials from store...");

            using (var credential = new CredentialManagement.Credential())
            {
                credential.Target          = RaceControlF1TV;
                credential.Type            = CredentialType.Generic;
                credential.PersistanceType = PersistanceType.LocalComputer;

                var deleted = credential.Delete();

                if (deleted)
                {
                    _logger.Info("Credentials deleted from store.");
                }
                else
                {
                    _logger.Warn("Credentials not deleted from store.");
                }

                return(deleted);
            }
        }
 /// <summary>
 ///     The on clear credentials.
 /// </summary>
 private void OnClearCredentials(object data)
 {
     using (var cm = new Credential { Target = "VSSonarQubeExtension", })
     {
         cm.Delete();
         this.ServerAddress = string.Empty;
         this.Password = string.Empty;
         this.UserName = string.Empty;
     }
 }
예제 #4
0
 /// <summary>
 /// Deletes a OneDrive Refresh Token from the Windows Credential Manager
 /// </summary>
 /// <param name="databaseFilePath">Full local path to the KeePass database for which to delete the OneDrive Refresh Token</param>
 public static void DeleteRefreshTokenFromWindowsCredentialManager(string databaseFilePath)
 {
     using (var credential = new Credential {Target = string.Concat("KoenZomers.KeePass.OneDriveSync:", databaseFilePath), Type = CredentialType.Generic})
     {
         // Verify if we have stored a token for this database
         if (credential.Exists())
         {
             // Delete the Windows Credential Manager entry
             credential.Delete();
         }
     }
 }