diff options
author | Jan Jahoda <aik.jahoda@post.cz> | 2021-03-05 19:33:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-05 19:33:01 +0300 |
commit | 7cf4f41ac49fa91205971130dc188fa5fc87418a (patch) | |
tree | 84b8c5dfccbaad52fdadadd59486690f36337ff5 | |
parent | f57dab4729377040840c42723debe0be34bc48cc (diff) |
Credentials fixes (#402)
* Credentials fixes
* remove dead code
* Update PostScenarioTest.cs
Revert variable name
8 files changed, 8 insertions, 36 deletions
diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs b/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs index ed78353c34..6175becdbe 100644 --- a/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs +++ b/src/System.Data.SqlClient/tests/FunctionalTests/DiagnosticTest.cs @@ -20,9 +20,9 @@ namespace System.Data.SqlClient.Tests { public class DiagnosticTest : RemoteExecutorTestBase { - private const string BadConnectionString = "data source = bad; initial catalog = bad; uid = bad; password = bad; connection timeout = 1;"; + private const string BadConnectionString = "data source = bad; initial catalog = bad; uid = bad; password = PLACEHOLDER; connection timeout = 1;"; private static readonly string s_tcpConnStr = Environment.GetEnvironmentVariable("TEST_TCP_CONN_STR") ?? string.Empty; - + public static bool IsConnectionStringConfigured() => s_tcpConnStr != string.Empty; [Fact] diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs b/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs index 5c07ba6cb1..9f5eb0c0d9 100644 --- a/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs +++ b/src/System.Data.SqlClient/tests/FunctionalTests/ExceptionTest.cs @@ -11,7 +11,7 @@ namespace System.Data.SqlClient.Tests public class ExceptionTest { // test connection string - private string connectionString = "server=tcp:server,1432;database=test;uid=admin;pwd=SQLDB;connect timeout=60;"; + private string connectionString = "server=tcp:server,1432;database=test;uid=admin;pwd=PLACEHOLDER;connect timeout=60;"; // data value and server consts private const string badServer = "NotAServer"; diff --git a/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs b/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs index 27758ef22a..b0cd9eeee1 100644 --- a/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs +++ b/src/System.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs @@ -108,7 +108,7 @@ namespace System.Data.SqlClient.Tests [Fact] public void ExceptionsWithMinPoolSizeCanBeHandled() { - string connectionString = $"Data Source={Guid.NewGuid().ToString()};uid=random;pwd=asd;Connect Timeout=2; Min Pool Size=3"; + string connectionString = $"Data Source={Guid.NewGuid().ToString()};uid=random;pwd=PLACEHOLDER;Connect Timeout=2; Min Pool Size=3"; for (int i = 0; i < 2; i++) { using (SqlConnection connection = new SqlConnection(connectionString)) diff --git a/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index a67a42483a..d0a49a6899 100644 --- a/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -364,7 +364,7 @@ namespace System.Diagnostics.Tests [Fact, PlatformSpecific(TestPlatforms.Windows), OuterLoop] // Uses P/Invokes, Requires admin privileges public void TestUserCredentialsPropertiesOnWindows() { - string username = "test", password = "PassWord123!!"; + string username = "test", password = "PLACEHOLDER"; try { Interop.NetUserAdd(username, password); diff --git a/src/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs b/src/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs index 1b02edc2eb..22b54d58d5 100644 --- a/src/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs +++ b/src/System.DirectoryServices.AccountManagement/tests/PrincipalTest.cs @@ -16,7 +16,7 @@ namespace System.DirectoryServices.AccountManagement.Tests private void RefreshContext() { string username = "Administrator"; - string password = "Adrumble@6"; + string password = "PLACEHOLDER"; string OU = "Tests"; string baseDomain = WindowsIdentity.GetCurrent().Name.Split(new char[] { '\\' })[1] + "-TEST"; diff --git a/src/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs b/src/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs index 80cdc51126..a708948b48 100644 --- a/src/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs +++ b/src/System.DirectoryServices.AccountManagement/tests/UserPrincipalTest.cs @@ -29,33 +29,5 @@ namespace System.DirectoryServices.AccountManagement.Tests UserPrincipal user = new UserPrincipal(DomainContext); user.Dispose(); } - - public void ComputedUACCheck() - { - string username = "Administrator"; - string password = "Adrumble@6"; - //TODO: don't assume it exists, create it if its not - string OU = "TestNull"; - string baseDomain =WindowsIdentity.GetCurrent().Name.Split(new char[] { '\\' })[1] + "-TEST"; - string domain = $"{baseDomain}.nttest.microsoft.com"; - string container = $"ou={OU},dc={baseDomain},dc=nttest,dc=microsoft,dc=com"; - - PrincipalContext context = new PrincipalContext(ContextType.Domain, domain, container, username, password); - UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, "good"); - - // set the wrong password to force account lockout - // Is there a way of doing it programmatically except for NetUserSetInfo? (managed code) - context.ValidateCredentials("good", "wrong password"); - - //verify that the account is locked out - Assert.True(user.IsAccountLockedOut(), "trying wrong credentials did not lock the account"); - - // if uac is not set correctly, this call might clear the lockout - user.SmartcardLogonRequired = false; - user.Save(); - - //verify that the account is still locked out - Assert.True(user.IsAccountLockedOut(), "the account is no longer locked out after writing setting SmartCardLogonRequired"); - } } } diff --git a/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs b/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs index ca5d55f1da..8f9bfe6dbe 100644 --- a/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs +++ b/src/System.Net.Http/tests/FunctionalTests/PostScenarioTest.cs @@ -18,7 +18,7 @@ namespace System.Net.Http.Functional.Tests { private const string ExpectedContent = "Test contest"; private const string UserName = "user1"; - private const string Password = "password1"; + private const string Password = "PLACEHOLDER"; private static readonly Uri BasicAuthServerUri = Configuration.Http.BasicAuthUriForCreds(false, UserName, Password); private static readonly Uri SecureBasicAuthServerUri = diff --git a/src/System.Net.Http/tests/UnitTests/DigestAuthenticationTests.cs b/src/System.Net.Http/tests/UnitTests/DigestAuthenticationTests.cs index 45d03712a7..31048346ee 100644 --- a/src/System.Net.Http/tests/UnitTests/DigestAuthenticationTests.cs +++ b/src/System.Net.Http/tests/UnitTests/DigestAuthenticationTests.cs @@ -49,7 +49,7 @@ namespace System.Net.Http.Tests [InlineData("realm=\"NetCore\", qop=\"auth\", stale=false", false)] public async void DigestResponse_AuthToken_Handling(string response, bool expectedResult) { - NetworkCredential credential = new NetworkCredential("foo","bar"); + NetworkCredential credential = new NetworkCredential("foo","PLACEHOLDER"); AuthenticationHelper.DigestResponse digestResponse = new AuthenticationHelper.DigestResponse(response); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://microsoft.com/"); string parameter = await AuthenticationHelper.GetDigestTokenForCredential(credential, request, digestResponse).ConfigureAwait(false); |