runtime icon indicating copy to clipboard operation
runtime copied to clipboard

SslStream/NegotiateStream should throw InvalidCredentialException when the authentication fails and cannot be retried

Open CIPop opened this issue 10 years ago • 10 comments

According to MSDN: https://msdn.microsoft.com/en-us/library/system.security.authentication.invalidcredentialexception(v=vs.110).aspx

The exception that is thrown when authentication fails for an authentication stream and cannot be retried.

At the moment SslStream is throwing only AuthenticationException.

CIPop avatar May 09 '16 22:05 CIPop

/cc @himadrisarkar @davidsh

CIPop avatar May 09 '16 22:05 CIPop

Next step:

  1. Verify Desktop behavior
  2. Fix MSDN or CoreFX to match the behavior (might have compat question 1.1->2.0)

karelz avatar Feb 23 '17 19:02 karelz

In SslStream’s MSDN (https://msdn.microsoft.com/en-us/library/system.net.security.sslstream(v=vs.110).aspx)

“If the authentication fails, you receive a AuthenticationException, and the SslStream is no longer useable. You should close this object and remove all references to it so that it can be collected by the garbage collector.”

So retry authentication is not possible for SSLStream, this is the first thing we need to notice.

Second, I have tested the behavior on .Net Desktop when authentication fails. It throws AuthenticationException, same as .Net Core does.

Therefore we need to fix the MSDN instead of the code.

caesar-chen avatar Apr 11 '17 23:04 caesar-chen

@schen381 which docs do we have to update? Can you please suggest new wording, then we should pass it to docs team. Thanks!

karelz avatar Apr 12 '17 00:04 karelz

@karelz I will discuss with Cristian offline tomorrow and follow up here. Thanks!

caesar-chen avatar Apr 12 '17 01:04 caesar-chen

@karelz We need to change the doc for InvalidCredentialException at https://docs.microsoft.com/en-us/dotnet/api/System.Security.Authentication.InvalidCredentialException?view=netframework-4.7, and the MSDN website will be phased out redirected to the new docs website. We need to change the Remark section and remove any occurrences of "SslStream" from it, because InvalidCredentialException only applies for NegotiateStream.

cc: @davidsh @CIPop

caesar-chen avatar Apr 12 '17 20:04 caesar-chen

@mairaw is the above information actionable for docs team? Should we move the bug to docs repo now?

karelz avatar Apr 12 '17 20:04 karelz

Thank you @schen381!

karelz avatar Apr 12 '17 20:04 karelz

Sure, we can change the remarks to remove any mentions of SslStream from it. I'll move this issue to our repo now.

mairaw avatar Apr 17 '17 21:04 mairaw

Issue moved to dotnet/docs dotnet/corefx#1941 via ZenHub

mairaw avatar Apr 17 '17 21:04 mairaw