Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTLM Authentication not working in .NET Core on Mac #46247

Closed
JeroenBer opened this issue Dec 19, 2020 · 7 comments
Closed

NTLM Authentication not working in .NET Core on Mac #46247

JeroenBer opened this issue Dec 19, 2020 · 7 comments

Comments

@JeroenBer
Copy link

Description

I Found that NTLM is not working correctly for .NET Core on Mac. To reproduce this I created a web page on Azure protected by NTLM and wrote some unit tests to validate the NTLM behavior. It is working correctly in all scenario's on .NET Core on Windows but for .NET Core on Mac it doesn't work correctly in a lot of scenario's:

Test results

Platform Use NetworkCredentials Use CredentialCache
Windows .NET Core 2.1 Success Success
Windows .NET Core 3.1 Success Success
Windows .NET Core 5.0 Success Success
Mac .NET Core 2.1 FAIL Success
Mac .NET Core 3.1 FAIL Success
Mac .NET Core 5.0 FAIL FAIL

The tests can be found in this public github project: https://github.com/JeroenBer/testntlm

Configuration

Run the .NET Core NTLM tests on Windows 10 (x64) from Visual Studio 2019 and they will all Succeed.
Run the same .NET Core tests in Visual Studio on Mac and they will partly fail (or fully on .NET Core 5.0)

Other information

I did not try the tests on Linux but they might also fail there.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Dec 19, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@JeroenBer
Copy link
Author

area-System.Net.Http
@Dotnet-GitSync-Bot

@ghost
Copy link

ghost commented Dec 19, 2020

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I Found that NTLM is not working correctly for .NET Core on Mac. To reproduce this I created a web page on Azure protected by NTLM and wrote some unit tests to validate the NTLM behavior. It is working correctly in all scenario's on .NET Core on Windows but for .NET Core on Mac it doesn't work correctly in a lot of scenario's:

Test results

Platform Use NetworkCredentials Use CredentialCache
Windows .NET Core 2.1 Success Success
Windows .NET Core 3.1 Success Success
Windows .NET Core 5.0 Success Success
Mac .NET Core 2.1 FAIL Success
Mac .NET Core 3.1 FAIL Success
Mac .NET Core 5.0 FAIL FAIL

The tests can be found in this public github project: https://github.com/JeroenBer/testntlm

Configuration

Run the .NET Core NTLM tests on Windows 10 (x64) from Visual Studio 2019 and they will all Succeed.
Run the same .NET Core tests in Visual Studio on Mac and they will partly fail (or fully on .NET Core 5.0)

Other information

I did not try the tests on Linux but they might also fail there.

Author: JeroenBer
Assignees: -
Labels:

area-System.Net.Http, untriaged

Milestone: -

@wfurt
Copy link
Member

wfurt commented Dec 21, 2020

NTLM on macOS never worked AFAIK - see #887. It is interesting you report it working as well it is interesting to see change in 5. For 2.1 we used curl directly so the implementation come with it.

@JeroenBer
Copy link
Author

JeroenBer commented Jan 3, 2021

Yes it certainly works on Mac .NET Core (2/3) if you add the following line:

 AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);

The main reason for posting this because we liked to get this fixed in .NET Core since Xamarin is also going to be part of .NET Core 6. And NTLM is also a problem in Xamarin Android/iOS/Mac (see xamarin/xamarin-macios#7770), there is a workaround there using the old MonoWebRequestHandler but I think this should be solved in .NET Core so it will be fixed once and for all. Is there any way to get this on the roadmap for .NET Core to have proper NTLM support on all platforms ?

@karelz
Copy link
Member

karelz commented Jan 15, 2021

Android/Xamarin solution is tracked separately in #32680

@karelz
Copy link
Member

karelz commented Jan 15, 2021

Closing this issue in favor of #887 and #32680

@karelz karelz closed this as completed Jan 15, 2021
@karelz karelz added this to the 6.0.0 milestone Jan 26, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 25, 2021
@karelz karelz removed the untriaged New issue has not been triaged by the area owner label Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants