public void ReadWrite()
    {
        string       username;
        SecureString password;

        DeleteCredentials();
        Assert.IsFalse(SavedCredentials.TryRetrieveSavedCredentials(out username, out password));
        Assert.IsNull(username);
        Assert.IsNull(password);
        SavedCredentials.SaveCredentials("username", "password".ToSecureString());
        Assert.IsTrue(SavedCredentials.TryRetrieveSavedCredentials(out username, out password));
        Assert.AreEqual("username", username);
        Assert.AreEqual("password", password.ToOriginalString());
    }
예제 #2
0
    public void RetrieveSavedCredentials()
    {
        SecureString password;
        string       username;

        if (SavedCredentials.TryRetrieveSavedCredentials(out username, out password))
        {
            Credentials = new NetworkCredential(username, password);
            LogTo.Information("Using stored proxy credentials");
            return;
        }

        LogTo.Information("No stored proxy credentials");
    }