Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static partial class PlatformDetection
public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
public static bool IsOpenSUSE => IsDistroAndVersion("opensuse");
public static bool IsUbuntu => IsDistroAndVersion("ubuntu");
public static bool IsUbuntu26 => IsDistroAndVersion("ubuntu", 26);
public static bool IsUbuntu24 => IsDistroAndVersion("ubuntu", 24);
public static bool IsUbuntu24OrHigher => IsDistroAndVersionOrHigher("ubuntu", 24);
public static bool IsDebian => IsDistroAndVersion("debian");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ namespace System.Net.Security.Tests
{
public class NegotiateAuthenticationTests
{
private static bool IsNtlmAvailable => Capability.IsNtlmInstalled() || OperatingSystem.IsAndroid() || OperatingSystem.IsTvOS();
// Ubuntu 24 and 26 ship with broekn gss-ntlmssp 1.2
private static bool UseManagedNtlm => PlatformDetection.IsUbuntu24 || PlatformDetection.IsUbuntu26;
private static bool IsNtlmAvailable => UseManagedNtlm || Capability.IsNtlmInstalled() || OperatingSystem.IsAndroid() || OperatingSystem.IsTvOS();
private static bool IsNtlmUnavailable => !IsNtlmAvailable;

private static NetworkCredential s_testCredentialRight = new NetworkCredential("rightusername", "rightpassword");
private static NetworkCredential s_testCredentialWrong = new NetworkCredential("rightusername", "wrongpassword");
private static readonly byte[] s_Hello = "Hello"u8.ToArray();

static NegotiateAuthenticationTests()
{
if (UseManagedNtlm)
{
AppContext.SetSwitch("System.Net.Security.UseManagedNtlm", true);
}
}

[Fact]
public void Constructor_Overloads_Validation()
{
Expand Down Expand Up @@ -85,7 +95,6 @@ public void Package_Supported_NTLM()
}

[ConditionalFact(nameof(IsNtlmUnavailable))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/111639", typeof(PlatformDetection), nameof(PlatformDetection.IsUbuntu24OrHigher))]
public void Package_Unsupported_NTLM()
{
NegotiateAuthenticationClientOptions clientOptions = new NegotiateAuthenticationClientOptions { Package = "NTLM", Credential = s_testCredentialRight, TargetName = "HTTP/foo" };
Expand Down
Loading