-
Notifications
You must be signed in to change notification settings - Fork 565
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
Can't disable authentication with HttpClientCredentialType.None #4708
Comments
I investigated a little. I think the issue is because of this code: wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpChannelFactory.cs Line 314 in 9bf1eea
It sets |
@imcarolwang can you please see if you could get a PR out this week? |
@Evgeny-A, I have a BasicHttpBinding service with Transport security mode and require certificate HttpClientCredentialType, at client side, I set wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/HttpResponseMessageHelper.cs Line 40 in 7f504aa
I don't see additional authentication done after that. Do I miss something? It would be great if you could share more behavior details of the problem you found. Thank you. |
I think certificate authentication is not related here.
Ensure server requires at least one of these authentication types, and does not allow anonymous access. When authentication fails, server should return not 403, but 401 status code. Check how many HTTP requests are actually made. What I expect: after 401 response for the very first request, error must be thrown that server requires authentication and client didn't provided any credentials. What I see: after 401 response for the first request, client makes second (and probably third in case of NTLM) request, trying to authenticate with default credentials. Request can even succeed (which is unexpected!) if default credentials are accepted by server as valid ones. |
@Evgeny-A Thank you for the quick turnaround! I now can reproduce the behavior you described and the fix you've proposed works as expected. I am going to submit a PR for review. |
Thank you. I'm glad to contribute. |
I'm going to close this issue as we've merged a fix. |
Describe the bug
If
ClientCredentialType
set toHttpClientCredentialType.None
in binding options, and server returns 401 status with WWW-Authenticate header, wcf client tries to authenticate.To Reproduce
Expected behavior
If server returns 401 status, client must just throw this error, without trying to authenticate.
The text was updated successfully, but these errors were encountered: