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

HttpClient throws exception when using invalid username/password on Linux #416

Closed
davidsh opened this issue Dec 1, 2019 · 0 comments · Fixed by #70474
Closed

HttpClient throws exception when using invalid username/password on Linux #416

davidsh opened this issue Dec 1, 2019 · 0 comments · Fixed by #70474
Assignees
Labels
area-System.Net.Http bug disabled-test The test is disabled in source code against the issue os-linux Linux OS (any supported distro) tenet-compatibility Incompatibility with previous versions or .NET Framework
Milestone

Comments

@davidsh
Copy link
Contributor

davidsh commented Dec 1, 2019

Found during my enterprise-scenario testing.

Sending a request with HttpClient to a server that requires Negotiate scheme authentication throws an exception on Linux when an incorrect username/password is used.

Sample repro:

[Fact]
public async Task HttpClient_InvalidAuthentication_Failure()
{
    using var handler = new HttpClientHandler();
    handler.Credentials = TestConfiguration.InvalidNetworkCredentials;
    using var client = new HttpClient(handler);

    using HttpResponseMessage response = await client.GetAsync(TestConfiguration.NegotiateAuthWebServer);
    Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
}

Stack:

System.Net.Http.Enterprise.Tests.HttpClientEnterpriseTest.HttpClient_InvalidAuthentication_Failure [FAIL]
System.ComponentModel.Win32Exception : GSSAPI operation failed with error - Unspecified GSS failure. Minor code may provide more information (SPNEGO failed to negotiate a mechanism).
Stack Trace:
/repo/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs(285,0): at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatusPal& statusCode) /repo/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs(187,0): at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob)

On Windows, an invalid username/password will simply cause no auth token to be generated and a final HTTP status code 401 will result for the request.

@davidsh davidsh added area-System.Net.Http os-linux Linux OS (any supported distro) labels Dec 1, 2019
@davidsh davidsh added this to the 5.0 milestone Dec 1, 2019
@davidsh davidsh self-assigned this Dec 1, 2019
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Dec 1, 2019
@davidsh davidsh removed the untriaged New issue has not been triaged by the area owner label Dec 1, 2019
@karelz karelz added bug disabled-test The test is disabled in source code against the issue labels Feb 20, 2020
@davidsh davidsh removed their assignment Jun 26, 2020
@wfurt wfurt self-assigned this Jul 9, 2020
@karelz karelz modified the milestones: 5.0.0, 6.0.0 Aug 10, 2020
@karelz karelz added tenet-compatibility Incompatibility with previous versions or .NET Framework disabled-test The test is disabled in source code against the issue and removed disabled-test The test is disabled in source code against the issue labels Aug 10, 2020
MichalStrehovsky pushed a commit to MichalStrehovsky/runtime that referenced this issue Mar 25, 2021
@karelz karelz modified the milestones: 6.0.0, Future May 4, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 13, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 14, 2022
radical pushed a commit to radical/runtime that referenced this issue Jul 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 14, 2022
@karelz karelz modified the milestones: Future, 7.0.0 Jul 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http bug disabled-test The test is disabled in source code against the issue os-linux Linux OS (any supported distro) tenet-compatibility Incompatibility with previous versions or .NET Framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants