diff options
author | Matt White <mattpwhite@gmail.com> | 2018-04-04 20:43:51 +0300 |
---|---|---|
committer | Max Kerr <rmkerr@users.noreply.github.com> | 2018-04-04 20:43:51 +0300 |
commit | 0b6a914dd83c0ddafb4e0698f16517515b3e1ee9 (patch) | |
tree | 414e0b386443293b2f45fec050755c15170d191a /src | |
parent | 0c7a1de0448c9dee76723d0bedd90f76c3436662 (diff) |
Prefix WWW-Authenticate header with scheme per RFC 4559 (#27755)
Fixes: #26606
Diffstat (limited to 'src')
-rw-r--r-- | src/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs b/src/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs index be8fe5fba1..38b6b05129 100644 --- a/src/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs +++ b/src/System.Net.HttpListener/src/System/Net/Windows/HttpListener.Windows.cs @@ -1008,7 +1008,10 @@ namespace System.Net if (decodedOutgoingBlob != null) { - outBlob = Convert.ToBase64String(decodedOutgoingBlob); + // Prefix SPNEGO token/NTLM challenge with scheme per RFC 4559, MS-NTHT + outBlob = string.Format("{0} {1}", + headerScheme == AuthenticationSchemes.Ntlm ? NegotiationInfoClass.NTLM : NegotiationInfoClass.Negotiate, + Convert.ToBase64String(decodedOutgoingBlob)); } if (!error) @@ -1099,12 +1102,9 @@ namespace System.Net { // auth incomplete newContext = context; - - challenge = (headerScheme == AuthenticationSchemes.Ntlm ? NegotiationInfoClass.NTLM : NegotiationInfoClass.Negotiate); - if (!String.IsNullOrEmpty(outBlob)) - { - challenge += " " + outBlob; - } + challenge = string.IsNullOrEmpty(outBlob) + ? headerScheme == AuthenticationSchemes.Ntlm ? NegotiationInfoClass.NTLM : NegotiationInfoClass.Negotiate + : outBlob; } } break; |