Skip to content

Commit

Permalink
Add temporary test to verify NTLM and Negotiate connections from all …
Browse files Browse the repository at this point in the history
…platforms

Notably this is expected to fail on Android and tvOS where GSSAPI is not available.

The test machine is single purpose virtual machine running in Azure with clean Windows Server 2019 installation and all the patches. It hosts IIS with single static page behind an NT authentication. The test account and the machine itself is disposable and does NOT contain any sensitive data. Nevertheless I don't expect this test to be merged.
  • Loading branch information
filipnavara committed Jun 12, 2021
1 parent 03914f7 commit abf44ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/libraries/System.Net.Http/tests/FunctionalTests/NtAuthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,23 @@ public async Task PostAsync_NtAuthServer_UseExpect100Header_Success(bool ntlm, i
}
}
}

[Theory]
[InlineData("NTLM")]
[InlineData("Negotiate")]
public async Task AuthTest(string authType)
{
var testUri = new Uri("http://emclientntlm.westus.cloudapp.azure.com/");
var networkCredential = new NetworkCredential("user1", "PLACEHOLDERcorrect20", "emclientntlm");

using var socketsHandler = new SocketsHttpHandler();
var credentialCache = new CredentialCache();
credentialCache.Add(testUri, authType, networkCredential);
socketsHandler.Credentials = credentialCache;

using var client = new HttpClient(socketsHandler);
var result = await client.GetAsync(testUri);
Assert.True(result.IsSuccessStatusCode);
}
}
}

0 comments on commit abf44ce

Please sign in to comment.