-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Make handling of DefaultCredentials in NegotiateAuthentication/SocketsHttpHandler more consistent #91160
Conversation
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones Issue DetailsSee PR #91138 for alternative approach. Report
|
Author: | filipnavara |
---|---|
Assignees: | - |
Labels: |
|
Milestone: | - |
Debug.Assert(clientOptions.Package == NegotiationInfoClass.NTLM); | ||
|
||
if (clientOptions.Credential == CredentialCache.DefaultNetworkCredentials || | ||
string.IsNullOrWhiteSpace(clientOptions.Credential.UserName) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be an &&
between username and password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was always ||
in all versions on .NET. It's not like empty user name with non-empty password, or vice versa, makes any sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not? I've seen services that only require password with empty username.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's valid in NTLM or Kerberos. It's valid in Basic authentication.
4850719
to
fd2af56
Compare
…ionPal implementation for NTLM w/ default credentials. This was handled inconsistently between the managed NTLM implementation and the GSSAPI one. Add test for the behavior. Add test to ensure SocketsHttpHandler using CredentialCache.DefaultCredentials with NTLM doesn't throw PNSE exception and returns the Unauthorized HTTP response instead.
fd2af56
to
f2d7525
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
See PR #91138 for alternative approach.Report
UnknownCredentials
status on Unix/Managed NegotiateAuthenticationPal implementation for NTLM w/ default credentialsthrowingcommunicating back withPlatformNotSupportedException
with a useful message that explains which parameters are unsupportedNegotiateAuthenticationStatusCode.UnknownCredentials
.SocketsHttpHandler
CredentialCache.DefaultCredentials
with NTLM doesn't throw PNSE exception and returns theUnauthorized
HTTP response instead.Fixes #91131