-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Milestone
Description
HttpClient with credentials explicitly set. SocketHttpHandler throws on NTLM authentication requested by server:
System.ComponentModel.Win32Exception (0x80090020): GSSAPI operation failed with error - An invalid status code was supplied (Unknown error).
at System.Net.Security.NegotiateStreamPal.AcquireCredentialsHandle(String package, Boolean isServer, NetworkCredential credential) in /home/build/github/corefx/src/Common/src/System/Net/Security/NegotiateStreamPal.Unix.cs:line 316
at System.Net.NTAuthentication.Initialize(Boolean isServer, String package, NetworkCredential credential, String spn, ContextFlagsPal requestedContextFlags, ChannelBinding channelBinding) in /home/build/github/corefx/src/Common/src/System/Net/NTAuthentication.Common.cs:line 128
at System.Net.NTAuthentication..ctor(Boolean isServer, String package, NetworkCredential credential, String spn, ContextFlagsPal requestedContextFlags, ChannelBinding channelBinding) in /home/build/github/corefx/src/Common/src/System/Net/NTAuthentication.Common.cs:line 98
at System.Net.Http.AuthenticationHelper.SendWithNtAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean isProxyAuth, HttpConnection connection, CancellationToken cancellationToken) in /home/build/github/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs:line 61
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) in /home/build/github/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnectionPool.cs:line 283
at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken) in /home/build/github/corefx/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs:line 204
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) in /home/build/github/corefx/src/Sys
Workarounds:
- Install package called
gss-ntlmssp(plugin into MIT Kerberos GSSAPI layer) - Install Heimdal (alternative Kerberos implementation with NTLM support): https://www.h5l.org/manual/heimdal-1-5-branch/ntlm/
One of the options installed is sufficient to make SocketHttpHandler work for NTLM without any additional changes to CoreFX or the app.
Details:
.NET Core 2.0 / 2.1 with libcurl works fine. This is because curl has it's own implementation but SocketHttpHandler depends on authentication code shared with NegotiateStream class.
The shared authentication depends on GSSAPI and that is typically provided by MIT kerberos. (this is also true for 2.1.300 preview docker images)
It does not have ability to do NTLM.
This is follow up on #25370 and #25368. This may be also related to dotnet/wcf#943
Reactions are currently unavailable