diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/Microsoft.AspNetCore.Authentication.Negotiate.FunctionalTest.csproj b/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/Microsoft.AspNetCore.Authentication.Negotiate.FunctionalTest.csproj
index 085e3ddfd8..bb84ed1c8d 100644
--- a/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/Microsoft.AspNetCore.Authentication.Negotiate.FunctionalTest.csproj
+++ b/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/Microsoft.AspNetCore.Authentication.Negotiate.FunctionalTest.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/NegotiateHandlerFunctionalTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/NegotiateHandlerFunctionalTests.cs
index 5d6ddad1c4..1a1c8def5c 100644
--- a/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/NegotiateHandlerFunctionalTests.cs
+++ b/src/Security/Authentication/Negotiate/test/Negotiate.FunctionalTest/NegotiateHandlerFunctionalTests.cs
@@ -6,6 +6,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Net.WebSockets;
+using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -23,7 +26,7 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
{
// In theory this would work on Linux and Mac, but the client would require explicit credentials.
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
- public class NegotiateHandlerFunctionalTests
+ public class NegotiateHandlerFunctionalTests : LoggedTest
{
private static readonly Version Http11Version = new Version(1, 1);
private static readonly Version Http2Version = new Version(2, 0);
@@ -109,6 +112,34 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate
Assert.Equal(Http11Version, result.Version); // HTTP/2 downgrades.
}
+ [ConditionalFact]
+ public async Task DefautCredentials_WebSocket_Success()
+ {
+ using var host = await CreateHostAsync();
+
+ var address = host.Services.GetRequiredService().Features.Get().Addresses.First().Replace("https://", "wss://");
+
+ using var webSocket = new ClientWebSocket
+ {
+ Options =
+ {
+ RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true,
+ UseDefaultCredentials = true,
+ }
+ };
+
+ using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
+
+ await webSocket.ConnectAsync(new Uri($"{address}/AuthenticateWebSocket"), cts.Token);
+
+ var receiveBuffer = new byte[13];
+ var receiveResult = await webSocket.ReceiveAsync(receiveBuffer, cts.Token);
+
+ Assert.True(receiveResult.EndOfMessage);
+ Assert.Equal(WebSocketMessageType.Text, receiveResult.MessageType);
+ Assert.Equal("Hello World!", Encoding.UTF8.GetString(receiveBuffer, 0, receiveResult.Count));
+ }
+
public static IEnumerable