- Could not get a list of browser tabs from {debuggerTabsListUrl}.
+ Could not get a list of browser tabs from {debuggerTabsListUrlEncoded}.
Ensure your browser is running with debugging enabled.
Resolution
If you are using Google Chrome or Chromium for your development, follow these instructions:
If you are using Microsoft Edge (80+) for your development, follow these instructions:
- {GetLaunchEdgeInstructions(targetApplicationUrl.ToString())}
+ {GetLaunchEdgeInstructions(targetApplicationUrlEncoded)}
This should launch a new browser window with debugging enabled..
Underlying exception:
@@ -316,8 +319,8 @@ Ensure your browser is running with debugging enabled.
var suffix = string.IsNullOrEmpty(targetApplicationUrl)
? string.Empty
- : $" matching the URL {WebUtility.HtmlEncode(targetApplicationUrl)}";
- await context.Response.WriteAsync($"
The list of targets returned by {WebUtility.HtmlEncode(debuggerTabsListUrl)} contains no entries{suffix}.
The list of targets returned by {debuggerTabsListUrlEncoded} contains no entries{suffix}.
");
await context.Response.WriteAsync("
Make sure your browser is displaying the target application.
");
}
else
diff --git a/src/Grpc/Interop/test/testassets/InteropClient/InteropClient.csproj b/src/Grpc/Interop/test/testassets/InteropClient/InteropClient.csproj
index fd5c67c74100..dc252e95e28b 100644
--- a/src/Grpc/Interop/test/testassets/InteropClient/InteropClient.csproj
+++ b/src/Grpc/Interop/test/testassets/InteropClient/InteropClient.csproj
@@ -4,6 +4,8 @@
Exe$(DefaultNetCoreTargetFramework)enable
+
+ $(NoWarn);NU1903
diff --git a/src/Identity/test/Identity.FunctionalTests/Extensions/HtmlAssert.cs b/src/Identity/test/Identity.FunctionalTests/Extensions/HtmlAssert.cs
index a42a344b178d..932b21f2a8ae 100644
--- a/src/Identity/test/Identity.FunctionalTests/Extensions/HtmlAssert.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Extensions/HtmlAssert.cs
@@ -1,9 +1,9 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using AngleSharp.Dom;
-using AngleSharp.Dom.Html;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Dom;
+using AngleSharp.Html.Parser;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
@@ -48,7 +48,7 @@ public static IHtmlFormElement HasForm(string selector, IParentNode document)
internal static IHtmlHtmlElement IsHtmlFragment(string htmlMessage)
{
var synteticNode = $"
{htmlMessage}
";
- var fragment = Assert.Single(new HtmlParser().ParseFragment(htmlMessage, context: null));
+ var fragment = Assert.Single(new HtmlParser().ParseFragment(htmlMessage, contextElement: null));
return Assert.IsAssignableFrom(fragment);
}
}
diff --git a/src/Identity/test/Identity.FunctionalTests/Extensions/HttpClientExtensions.cs b/src/Identity/test/Identity.FunctionalTests/Extensions/HttpClientExtensions.cs
index 67dbabda1a2c..9f87e3bba262 100644
--- a/src/Identity/test/Identity.FunctionalTests/Extensions/HttpClientExtensions.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Extensions/HttpClientExtensions.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/Extensions/ResponseAssert.cs b/src/Identity/test/Identity.FunctionalTests/Extensions/ResponseAssert.cs
index 3211efae7da6..4b938b670bfe 100644
--- a/src/Identity/test/Identity.FunctionalTests/Extensions/ResponseAssert.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Extensions/ResponseAssert.cs
@@ -1,12 +1,12 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using AngleSharp;
-using AngleSharp.Dom.Html;
-using AngleSharp.Network;
+using AngleSharp.Html.Dom;
+using AngleSharp.Io;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/Infrastructure/DefaultUIPage.cs b/src/Identity/test/Identity.FunctionalTests/Infrastructure/DefaultUIPage.cs
index cf2fa795f1aa..3b326d455690 100644
--- a/src/Identity/test/Identity.FunctionalTests/Infrastructure/DefaultUIPage.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Infrastructure/DefaultUIPage.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/Infrastructure/HtmlPage.cs b/src/Identity/test/Identity.FunctionalTests/Infrastructure/HtmlPage.cs
index 582446300e8d..38a1585806a3 100644
--- a/src/Identity/test/Identity.FunctionalTests/Infrastructure/HtmlPage.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Infrastructure/HtmlPage.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ConfirmEmail.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ConfirmEmail.cs
index 1c8b029e5c29..30743ee6ab10 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ConfirmEmail.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ConfirmEmail.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ExternalLogin.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ExternalLogin.cs
index 7084a50a0d0d..0cd6a8e74039 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ExternalLogin.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ExternalLogin.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPassword.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPassword.cs
index f7067dcc7603..0d81e1754b59 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPassword.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPassword.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPasswordConfirmation.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPasswordConfirmation.cs
index 71956fca5eb6..3cfae54e67a2 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPasswordConfirmation.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ForgotPasswordConfirmation.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Login.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Login.cs
index 11ce7decf84c..909a1edebc74 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Login.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Login.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWith2fa.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWith2fa.cs
index b972c572c9fb..4a7557c36d90 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWith2fa.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWith2fa.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWithRecoveryCode.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWithRecoveryCode.cs
index 4503fc34e2fb..47f321ec315d 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWithRecoveryCode.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/LoginWithRecoveryCode.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ChangePassword.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ChangePassword.cs
index 4aab34aa905c..97904e801ec3 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ChangePassword.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ChangePassword.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/DeleteUser.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/DeleteUser.cs
index d97a73a56422..cba08c50ddd3 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/DeleteUser.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/DeleteUser.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Email.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Email.cs
index fa778b9b1f98..cd2cb10ecf81 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Email.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Email.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/EnableAuthenticator.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/EnableAuthenticator.cs
index e888c22d04c9..d1187bd8cdc5 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/EnableAuthenticator.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/EnableAuthenticator.cs
@@ -3,7 +3,7 @@
using System.Globalization;
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ExternalLogins.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ExternalLogins.cs
index 45e064d45194..c6f3cff08f3d 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ExternalLogins.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ExternalLogins.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Index.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Index.cs
index 4a63cc78d96a..46cd2a87f094 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Index.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/Index.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/LinkExternalLogin.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/LinkExternalLogin.cs
index 030b4bcf84ae..5f307c628250 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/LinkExternalLogin.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/LinkExternalLogin.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ManageExternalLogin.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ManageExternalLogin.cs
index 9a82c198d058..d62ec5cfb241 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ManageExternalLogin.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ManageExternalLogin.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/PersonalData.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/PersonalData.cs
index 551fec94f936..791c7f92d1a2 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/PersonalData.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/PersonalData.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/RemoveExternalLogin.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/RemoveExternalLogin.cs
index 4cba92d05b1a..e3d9cebdab21 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/RemoveExternalLogin.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/RemoveExternalLogin.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ResetAuthenticator.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ResetAuthenticator.cs
index 15137e1e4b37..b85027d78ffa 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ResetAuthenticator.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ResetAuthenticator.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/SetPassword.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/SetPassword.cs
index 7a54684e0020..2f4a32a86053 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/SetPassword.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/SetPassword.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ShowRecoveryCodes.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ShowRecoveryCodes.cs
index 9d5e7acff82c..33c6355519f4 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ShowRecoveryCodes.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/ShowRecoveryCodes.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/TwoFactorAuthentication.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/TwoFactorAuthentication.cs
index 1750738d9633..78fd5d5b588a 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/TwoFactorAuthentication.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Manage/TwoFactorAuthentication.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Register.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Register.cs
index 7c31c62b265d..5e54bc24508b 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/Register.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/Register.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResendEmailConfirmation.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResendEmailConfirmation.cs
index 404db94a1558..70998f5efa0c 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResendEmailConfirmation.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResendEmailConfirmation.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPassword.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPassword.cs
index c51504ea3713..d05b51c25962 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPassword.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPassword.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPasswordConfirmation.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPasswordConfirmation.cs
index 461610a69117..16ab27fbb5bb 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPasswordConfirmation.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Account/ResetPasswordConfirmation.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Account;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Contoso/Login.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Contoso/Login.cs
index b42ef002d1c2..9f6d429fbae4 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Contoso/Login.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Contoso/Login.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account;
namespace Microsoft.AspNetCore.Identity.FunctionalTests.Contoso;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/Index.cs b/src/Identity/test/Identity.FunctionalTests/Pages/Index.cs
index ee50726d3c17..e32c54bcbcaa 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/Index.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/Index.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/Pages/RegisterConfirmation.cs b/src/Identity/test/Identity.FunctionalTests/Pages/RegisterConfirmation.cs
index fcd6583a7e30..2acf19823987 100644
--- a/src/Identity/test/Identity.FunctionalTests/Pages/RegisterConfirmation.cs
+++ b/src/Identity/test/Identity.FunctionalTests/Pages/RegisterConfirmation.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account;
namespace Microsoft.AspNetCore.Identity.FunctionalTests;
diff --git a/src/Identity/test/Identity.FunctionalTests/UserStories.cs b/src/Identity/test/Identity.FunctionalTests/UserStories.cs
index b6e2641ac992..ce85a9704138 100644
--- a/src/Identity/test/Identity.FunctionalTests/UserStories.cs
+++ b/src/Identity/test/Identity.FunctionalTests/UserStories.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Identity.DefaultUI.WebSite;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account;
using Microsoft.AspNetCore.Identity.FunctionalTests.Account.Manage;
diff --git a/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs b/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs
index f260f29b8712..3a64d0ce1822 100644
--- a/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs
+++ b/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs
@@ -4,8 +4,8 @@
using System.Net.Http;
using System.Reflection;
using System.Security.Cryptography;
-using AngleSharp.Dom.Html;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Dom;
+using AngleSharp.Html.Parser;
using Microsoft.AspNetCore.InternalTesting;
using Xunit.Abstractions;
@@ -128,7 +128,7 @@ private static List GetScriptTags(string cshtmlFile)
var htmlParser = new HtmlParser();
using (var stream = File.OpenRead(cshtmlFile))
{
- htmlDocument = htmlParser.Parse(stream);
+ htmlDocument = htmlParser.ParseDocument(stream);
}
var scriptTags = new List();
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
index 37ba74970ff7..b503cafb058b 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMIISExpressV2/ancm_iis_expressv2.wxs
@@ -502,7 +502,7 @@
-
+
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMV2/aspnetcoremodulev2.wxs b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMV2/aspnetcoremodulev2.wxs
index 82a20b5acd33..15723e033543 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/ANCMV2/aspnetcoremodulev2.wxs
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/ANCMV2/aspnetcoremodulev2.wxs
@@ -291,7 +291,7 @@
-
+
diff --git a/src/Installers/Windows/Wix.targets b/src/Installers/Windows/Wix.targets
index 2d29fd599a7e..a67fa522e26c 100644
--- a/src/Installers/Windows/Wix.targets
+++ b/src/Installers/Windows/Wix.targets
@@ -86,16 +86,6 @@
-
-
-
-
-
-
- $(DefineConstants);DepProviderGuid=$(DepProviderGuid)
-
-
-
diff --git a/src/Mvc/test/Mvc.FunctionalTests/AntiforgeryTestHelper.cs b/src/Mvc/test/Mvc.FunctionalTests/AntiforgeryTestHelper.cs
index 071f0dddd63e..6c8c199a48fe 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/AntiforgeryTestHelper.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/AntiforgeryTestHelper.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Parser;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests;
@@ -14,7 +14,7 @@ public static string RetrieveAntiforgeryToken(string htmlContent)
public static string RetrieveAntiforgeryToken(string htmlContent, string actionUrl)
{
var parser = new HtmlParser();
- var htmlDocument = parser.Parse(htmlContent);
+ var htmlDocument = parser.ParseDocument(htmlContent);
return htmlDocument.RetrieveAntiforgeryToken();
}
diff --git a/src/Mvc/test/Mvc.FunctionalTests/ComponentRenderingFunctionalTests.cs b/src/Mvc/test/Mvc.FunctionalTests/ComponentRenderingFunctionalTests.cs
index d319827f9a33..ca644c26437d 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/ComponentRenderingFunctionalTests.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/ComponentRenderingFunctionalTests.cs
@@ -4,7 +4,7 @@
using System.Net;
using System.Net.Http;
using System.Reflection;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Parser;
using BasicWebSite;
using BasicWebSite.Services;
using Microsoft.AspNetCore.InternalTesting;
@@ -173,7 +173,7 @@ public async Task Renders_AsyncComponent()
private void AssertComponent(string expectedContent, string divId, string responseContent)
{
var parser = new HtmlParser();
- var htmlDocument = parser.Parse(responseContent);
+ var htmlDocument = parser.ParseDocument(responseContent);
var div = htmlDocument.Body.QuerySelector($"#{divId}");
var content = div.InnerHtml;
Assert.Equal(
diff --git a/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs b/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs
index ed0c7b417490..3c32f9abe43f 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs
@@ -2,9 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net.Http;
+using AngleSharp;
using AngleSharp.Dom;
-using AngleSharp.Dom.Html;
-using AngleSharp.Extensions;
+using AngleSharp.Html.Dom;
using AngleSharp.Html;
using HtmlGenerationWebSite;
using Microsoft.AspNetCore.Hosting;
diff --git a/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/HttpClientExtensions.cs b/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/HttpClientExtensions.cs
index d58d130758f0..c4672309ba97 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/HttpClientExtensions.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/HttpClientExtensions.cs
@@ -1,10 +1,10 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Net;
using System.Net.Http;
-using AngleSharp.Dom.Html;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Dom;
+using AngleSharp.Html.Parser;
using Xunit.Sdk;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests;
@@ -23,7 +23,7 @@ public static async Task GetHtmlDocumentAsync(this HttpResponseMe
{
var content = await response.Content.ReadAsStringAsync();
var parser = new HtmlParser();
- var document = parser.Parse(content);
+ var document = parser.ParseDocument(content);
if (document == null)
{
throw new InvalidOperationException("Response content could not be parsed as HTML: " + Environment.NewLine + content);
diff --git a/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/IHtmlDocumentExtensions.cs b/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/IHtmlDocumentExtensions.cs
index e1c47dfa4aea..84b32f710be4 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/IHtmlDocumentExtensions.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/Infrastructure/IHtmlDocumentExtensions.cs
@@ -1,8 +1,8 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using AngleSharp.Dom;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
namespace Microsoft.AspNetCore.Mvc.FunctionalTests;
diff --git a/src/Mvc/test/Mvc.FunctionalTests/NonNullableReferenceTypesTest.cs b/src/Mvc/test/Mvc.FunctionalTests/NonNullableReferenceTypesTest.cs
index cec22f3d78f2..e27994e50ed0 100644
--- a/src/Mvc/test/Mvc.FunctionalTests/NonNullableReferenceTypesTest.cs
+++ b/src/Mvc/test/Mvc.FunctionalTests/NonNullableReferenceTypesTest.cs
@@ -4,7 +4,7 @@
using System.Net;
using System.Net.Http;
using System.Reflection;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Parser;
using Microsoft.AspNetCore.InternalTesting;
using Xunit.Abstractions;
@@ -41,7 +41,7 @@ public async Task CanUseNonNullableReferenceType_WithController_OmitData_Validat
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
var content = await response.Content.ReadAsStringAsync();
- var document = parser.Parse(content);
+ var document = parser.ParseDocument(content);
var errors = document.QuerySelectorAll("#errors > ul > li");
var li = Assert.Single(errors);
Assert.Empty(li.TextContent);
@@ -65,7 +65,7 @@ public async Task CanUseNonNullableReferenceType_WithController_OmitData_Validat
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
content = await response.Content.ReadAsStringAsync();
- document = parser.Parse(content);
+ document = parser.ParseDocument(content);
errors = errors = document.QuerySelectorAll("#errors > ul > li");
Assert.Equal(2, errors.Length); // Not validating BCL error messages
}
@@ -83,7 +83,7 @@ public async Task CanUseNonNullableReferenceType_WithController_SubmitData_NoErr
await response.AssertStatusCodeAsync(HttpStatusCode.OK);
var content = await response.Content.ReadAsStringAsync();
- var document = parser.Parse(content);
+ var document = parser.ParseDocument(content);
var errors = document.QuerySelectorAll("#errors > ul > li");
var li = Assert.Single(errors);
Assert.Empty(li.TextContent);
diff --git a/src/ProjectTemplates/Shared/AspNetProcess.cs b/src/ProjectTemplates/Shared/AspNetProcess.cs
index 0d9e02a7d316..c92ea5151220 100644
--- a/src/ProjectTemplates/Shared/AspNetProcess.cs
+++ b/src/ProjectTemplates/Shared/AspNetProcess.cs
@@ -5,8 +5,8 @@
using System.Net;
using System.Net.Http;
using System.Net.Security;
-using AngleSharp.Dom.Html;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Dom;
+using AngleSharp.Html.Parser;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.Extensions.CommandLineUtils;
@@ -141,7 +141,7 @@ public async Task ContainsLinks(Page page)
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var parser = new HtmlParser();
- var html = await parser.ParseAsync(await response.Content.ReadAsStreamAsync());
+ var html = await parser.ParseDocumentAsync(await response.Content.ReadAsStreamAsync());
foreach (IHtmlLinkElement styleSheet in html.GetElementsByTagName("link"))
{
diff --git a/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs b/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs
index 45d3973a140f..4a537dc034d9 100644
--- a/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs
+++ b/src/Security/Authentication/Negotiate/src/Internal/LdapAdapter.cs
@@ -21,7 +21,32 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti
{
var user = identity.Name!;
var userAccountNameIndex = user.IndexOf('@');
- var userAccountName = userAccountNameIndex == -1 ? user : user.Substring(0, userAccountNameIndex);
+
+ // Without a realm in the name (no '@'), we cannot tell which directory the principal came from.
+ // The local part alone is not a safe LDAP lookup key — sAMAccountName is unique only within a single domain,
+ // so any same-named account in the configured domain would be returned.
+ if (userAccountNameIndex == -1)
+ {
+ logger.LogDebug(
+ "Skipping LDAP claim resolution for '{User}': its realm cannot be verified against the configured LDAP domain '{Domain}'.",
+ user, settings.Domain);
+
+ return;
+ }
+
+ // With a realm that doesn't match settings.Domain the principal authenticated through a foreign Kerberos realm
+ // should NOT be trusted by the application's realm.
+ var realm = user.AsSpan(userAccountNameIndex + 1);
+ if (!realm.Equals(settings.Domain.AsSpan(), StringComparison.OrdinalIgnoreCase))
+ {
+ logger.LogDebug(
+ "Skipping LDAP claim resolution for '{User}': principal realm does not match the configured LDAP domain '{Domain}'. Cross-domain claim resolution is not supported.",
+ user, settings.Domain);
+
+ return;
+ }
+
+ var userAccountName = user[..userAccountNameIndex];
if (settings.ClaimsCache == null)
{
@@ -41,7 +66,7 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti
var distinguishedName = settings.Domain.Split('.').Select(name => $"dc={name}").Aggregate((a, b) => $"{a},{b}");
var retrievedClaims = new List();
- var filter = $"(&(objectClass=user)(sAMAccountName={userAccountName}))"; // This is using ldap search query language, it is looking on the server for someUser
+ var filter = $"(&(objectClass=user)(sAMAccountName={EscapeLdapFilterValue(userAccountName)}))"; // This is using ldap search query language, it is looking on the server for someUser
var searchRequest = new SearchRequest(distinguishedName, filter, SearchScope.Subtree);
Debug.Assert(settings.LdapConnection != null);
@@ -70,7 +95,7 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti
if (!settings.IgnoreNestedGroups)
{
- GetNestedGroups(settings.LdapConnection, identity, distinguishedName, groupCN, logger, retrievedClaims, new HashSet());
+ GetNestedGroups(settings.LdapConnection, identity, distinguishedName, groupDN, groupCN, logger, retrievedClaims, new HashSet());
}
else
{
@@ -98,23 +123,29 @@ public static async Task RetrieveClaimsAsync(LdapSettings settings, ClaimsIdenti
}
}
- private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity principal, string distinguishedName, string groupCN, ILogger logger, IList retrievedClaims, HashSet processedGroups)
+ private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity principal, string distinguishedName, string groupDN, string groupCN, ILogger logger, IList retrievedClaims, HashSet processedGroups)
{
retrievedClaims.Add(groupCN);
- var filter = $"(&(objectClass=group)(sAMAccountName={groupCN}))"; // This is using ldap search query language, it is looking on the server for someUser
- var searchRequest = new SearchRequest(distinguishedName, filter, SearchScope.Subtree);
- var searchResponse = (SearchResponse)connection.SendRequest(searchRequest);
+ // Look up the group entry by its distinguished name using base scope:
+ // a base-scope read against the DN is the only LDAP operation that
+ // returns exactly the intended group object.
+ var searchRequest = new SearchRequest(groupDN, "(objectClass=group)", SearchScope.Base);
+ SearchResponse searchResponse;
+ try
+ {
+ searchResponse = (SearchResponse)connection.SendRequest(searchRequest);
+ }
+ catch (DirectoryOperationException ex) when (ex.Response is SearchResponse r && r.ResultCode == ResultCode.NoSuchObject)
+ {
+ // Stale memberOf reference: group no longer exists. Stop traversal of this branch.
+ logger.LogDebug("Stale memberOf reference: group with distinguished name '{GroupDN}' no longer exists; stopping traversal.", groupDN);;
+ return;
+ }
if (searchResponse.Entries.Count > 0)
{
- if (searchResponse.Entries.Count > 1 && logger.IsEnabled(LogLevel.Warning))
- {
- logger.LogWarning($"More than one response received for query: {filter} with distinguished name: {distinguishedName}");
- }
-
var group = searchResponse.Entries[0]; // Get the object that was found on ldap
- var groupDN = group.DistinguishedName;
processedGroups.Add(groupDN);
@@ -132,9 +163,45 @@ private static void GetNestedGroups(LdapConnection connection, ClaimsIdentity pr
return;
}
- GetNestedGroups(connection, principal, distinguishedName, nestedGroupCN, logger, retrievedClaims, processedGroups);
+ GetNestedGroups(connection, principal, distinguishedName, nestedGroupDN, nestedGroupCN, logger, retrievedClaims, processedGroups);
}
}
}
}
+
+ ///
+ /// Escapes special characters in a value used in an LDAP search filter per RFC 4515
+ /// https://datatracker.ietf.org/doc/html/rfc4515#section-3
+ ///
+ // internal for testing
+ internal static string EscapeLdapFilterValue(string value)
+ {
+ var sb = new StringBuilder(value.Length);
+ foreach (var c in value)
+ {
+ switch (c)
+ {
+ case '\\':
+ sb.Append(@"\5c");
+ break;
+ case '*':
+ sb.Append(@"\2a");
+ break;
+ case '(':
+ sb.Append(@"\28");
+ break;
+ case ')':
+ sb.Append(@"\29");
+ break;
+ case '\0':
+ sb.Append(@"\00");
+ break;
+ default:
+ sb.Append(c);
+ break;
+ }
+ }
+
+ return sb.ToString();
+ }
}
diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs
index 415ad540ab1f..bf7b4d07e200 100644
--- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs
+++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/LdapAdapterTests.cs
@@ -1,10 +1,122 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Security.Claims;
+using Microsoft.Extensions.Caching.Memory;
+using Microsoft.Extensions.Logging.Abstractions;
+
namespace Microsoft.AspNetCore.Authentication.Negotiate.Test;
public class LdapAdapterTests
{
+ [Fact]
+ public async Task RetrieveClaimsAsync_ForeignRealm_SkipsLookupAndAddsNoClaims()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp"
+ };
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin@foreign.corp")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType);
+ }
+
+ [Fact]
+ public async Task RetrieveClaimsAsync_ForeignRealm_DifferentCasing_SkipsLookup()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp",
+ };
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin@FOREIGN.CORP")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType);
+ }
+
+ [Fact]
+ public async Task RetrieveClaimsAsync_BareUsernameNoRealm_SkipsLookup()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp",
+ };
+
+ // No '@' means we cannot verify which realm "admin" came from.
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "admin")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType);
+ }
+
+ [Fact]
+ public async Task RetrieveClaimsAsync_DownLevelDomainUser_SkipsLookup()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp",
+ };
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, @"LOCAL\admin")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ Assert.DoesNotContain(identity.Claims, c => c.Type == identity.RoleClaimType);
+ }
+
+ [Fact]
+ public async Task RetrieveClaimsAsync_MatchingRealm_SameCasing_RetrievesCachedClaims()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp",
+ };
+ var roles = new[] { "Engineers", "Admins" };
+ var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = settings.ClaimsCacheSize });
+ cache.Set("alice@local.corp", (IEnumerable)roles, new MemoryCacheEntryOptions().SetSize(64));
+ settings.ClaimsCache = cache;
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "alice@local.corp")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ var roleClaims = identity.Claims
+ .Where(c => c.Type == identity.RoleClaimType)
+ .Select(c => c.Value)
+ .ToArray();
+ Assert.Equal(roles, roleClaims);
+ }
+
+ [Fact]
+ public async Task RetrieveClaimsAsync_MatchingRealm_DifferentCasing_RetrievesCachedClaims()
+ {
+ var settings = new LdapSettings
+ {
+ EnableLdapClaimResolution = true,
+ Domain = "local.corp",
+ };
+ var roles = new[] { "Engineers", "Admins" };
+ var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = settings.ClaimsCacheSize });
+ cache.Set("alice@LOCAL.CORP", (IEnumerable)roles, new MemoryCacheEntryOptions().SetSize(64));
+ settings.ClaimsCache = cache;
+ var identity = new ClaimsIdentity([new Claim(ClaimTypes.Name, "alice@LOCAL.CORP")], "Negotiate");
+
+ await LdapAdapter.RetrieveClaimsAsync(settings, identity, NullLogger.Instance);
+
+ var roleClaims = identity.Claims
+ .Where(c => c.Type == identity.RoleClaimType)
+ .Select(c => c.Value)
+ .ToArray();
+ Assert.Equal(roles, roleClaims);
+ }
+
[Fact]
public void DistinguishedNameWithoutCommasSuccess()
{
@@ -36,4 +148,47 @@ public void DistinguishedNameWithEscapedBackslashAndNotEscapedCommaSuccess()
Assert.Equal(new[] { @"Testing group\\", "City" }, parts);
}
+
+ [Fact]
+ public void EscapeLdapFilterValue_PlainValue_ReturnsUnchanged()
+ {
+ Assert.Equal("JohnDoe", LdapAdapter.EscapeLdapFilterValue("JohnDoe"));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_Wildcard_IsEscaped()
+ {
+ Assert.Equal(@"\2a", LdapAdapter.EscapeLdapFilterValue("*"));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_Parentheses_AreEscaped()
+ {
+ Assert.Equal(@"John\28Dev\29", LdapAdapter.EscapeLdapFilterValue("John(Dev)"));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_Backslash_IsEscaped()
+ {
+ Assert.Equal(@"DOMAIN\5cUser", LdapAdapter.EscapeLdapFilterValue(@"DOMAIN\User"));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_NullChar_IsEscaped()
+ {
+ Assert.Equal(@"before\00after", LdapAdapter.EscapeLdapFilterValue("before\0after"));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_InjectionPayload_IsNeutralized()
+ {
+ var malicious = "x)(sAMAccountName=*";
+ Assert.Equal(@"x\29\28sAMAccountName=\2a", LdapAdapter.EscapeLdapFilterValue(malicious));
+ }
+
+ [Fact]
+ public void EscapeLdapFilterValue_EmptyString_ReturnsEmpty()
+ {
+ Assert.Equal(string.Empty, LdapAdapter.EscapeLdapFilterValue(string.Empty));
+ }
}
diff --git a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs
index df34ce9a84ad..7b8e0b105f84 100644
--- a/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs
+++ b/src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs
@@ -215,7 +215,7 @@ public async Task AuthHeaderAfterNtlmCompleted_ReAuthenticates(bool persist)
public async Task RBACClaimsRetrievedFromCacheAfterKerberosCompleted()
{
var claimsCache = new MemoryCache(new MemoryCacheOptions());
- claimsCache.Set("name", new string[] { "CN=Domain Admins,CN=Users,DC=domain,DC=net" });
+ claimsCache.Set("name@domain.NET", new string[] { "CN=Domain Admins,CN=Users,DC=domain,DC=net" });
NegotiateOptions negotiateOptions = null;
using var host = await CreateHostAsync(options =>
{
@@ -554,7 +554,7 @@ public IIdentity GetIdentity()
{
throw new InvalidOperationException("Authentication is not complete.");
}
- return new GenericIdentity("name", _protocol);
+ return new GenericIdentity("name@domain.NET", _protocol);
}
public string GetOutgoingBlob(string incomingBlob, out BlobErrorType errorType, out Exception ex)
diff --git a/src/Security/test/AuthSamples.FunctionalTests/HttpClientExtensions.cs b/src/Security/test/AuthSamples.FunctionalTests/HttpClientExtensions.cs
index e32d5e13746e..b84f8816553b 100644
--- a/src/Security/test/AuthSamples.FunctionalTests/HttpClientExtensions.cs
+++ b/src/Security/test/AuthSamples.FunctionalTests/HttpClientExtensions.cs
@@ -1,11 +1,11 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
-using AngleSharp.Dom.Html;
+using AngleSharp.Html.Dom;
using Xunit;
namespace AuthSamples.FunctionalTests;
diff --git a/src/Security/test/AuthSamples.FunctionalTests/TestAssert.cs b/src/Security/test/AuthSamples.FunctionalTests/TestAssert.cs
index e480683a3255..7ea3ff2482d3 100644
--- a/src/Security/test/AuthSamples.FunctionalTests/TestAssert.cs
+++ b/src/Security/test/AuthSamples.FunctionalTests/TestAssert.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
@@ -11,9 +11,9 @@
using System.Threading.Tasks;
using AngleSharp;
using AngleSharp.Dom;
-using AngleSharp.Dom.Html;
-using AngleSharp.Network;
-using AngleSharp.Parser.Html;
+using AngleSharp.Html.Dom;
+using AngleSharp.Html.Parser;
+using AngleSharp.Io;
using Xunit;
namespace AuthSamples.FunctionalTests;
@@ -60,7 +60,7 @@ public static IHtmlFormElement HasForm(string selector, IParentNode document)
internal static IHtmlHtmlElement IsHtmlFragment(string htmlMessage)
{
var synteticNode = $"
{htmlMessage}
";
- var fragment = Assert.Single(new HtmlParser().ParseFragment(htmlMessage, context: null));
+ var fragment = Assert.Single(new HtmlParser().ParseFragment(htmlMessage, contextElement: null));
return Assert.IsAssignableFrom(fragment);
}
diff --git a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj
index 938f1d0cc1e1..9c85242f7e52 100644
--- a/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj
+++ b/src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj
@@ -10,6 +10,8 @@
truetrue
+
+ $(NoWarn);NU1903;NU1904
diff --git a/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj b/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj
index 2947cd817fd1..34df90495908 100644
--- a/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj
+++ b/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj
@@ -32,6 +32,13 @@
+
+
+