Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AuthenticationHelper.cs
Go to the documentation of this file.
6using System.Text;
9
10namespace System.Net.Http;
11
12internal static class AuthenticationHelper
13{
14 private enum AuthenticationType
15 {
16 Basic,
17 Digest,
18 Ntlm,
20 }
21
40
41 internal sealed class DigestResponse
42 {
44
45 internal DigestResponse(string challenge)
46 {
47 if (!string.IsNullOrEmpty(challenge))
48 {
50 }
51 }
52
53 private static bool CharIsSpaceOrTab(char ch)
54 {
55 if (ch != ' ')
56 {
57 return ch == '\t';
58 }
59 return true;
60 }
61
62 private static bool MustValueBeQuoted(string key)
63 {
64 if (!key.Equals("realm", StringComparison.OrdinalIgnoreCase) && !key.Equals("nonce", StringComparison.OrdinalIgnoreCase) && !key.Equals("opaque", StringComparison.OrdinalIgnoreCase))
65 {
66 return key.Equals("qop", StringComparison.OrdinalIgnoreCase);
67 }
68 return true;
69 }
70
71 private string GetNextKey(string data, int currentIndex, out int parsedIndex)
72 {
73 while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex]))
74 {
75 currentIndex++;
76 }
77 int num = currentIndex;
78 while (currentIndex < data.Length && data[currentIndex] != '=' && !CharIsSpaceOrTab(data[currentIndex]))
79 {
80 currentIndex++;
81 }
82 if (currentIndex == data.Length)
83 {
84 parsedIndex = currentIndex;
85 return null;
86 }
87 int length = currentIndex - num;
88 if (CharIsSpaceOrTab(data[currentIndex]))
89 {
90 while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex]))
91 {
92 currentIndex++;
93 }
94 if (currentIndex == data.Length || data[currentIndex] != '=')
95 {
96 parsedIndex = currentIndex;
97 return null;
98 }
99 }
100 while (currentIndex < data.Length && (CharIsSpaceOrTab(data[currentIndex]) || data[currentIndex] == '='))
101 {
102 currentIndex++;
103 }
104 parsedIndex = currentIndex;
105 return data.Substring(num, length);
106 }
107
108 private string GetNextValue(string data, int currentIndex, bool expectQuotes, out int parsedIndex)
109 {
110 bool flag = false;
111 if (data[currentIndex] == '"')
112 {
113 flag = true;
114 currentIndex++;
115 }
116 if (expectQuotes && !flag)
117 {
118 parsedIndex = currentIndex;
119 return null;
120 }
122 while (currentIndex < data.Length && ((flag && data[currentIndex] != '"') || (!flag && data[currentIndex] != ',')))
123 {
124 stringBuilder.Append(data[currentIndex]);
125 currentIndex++;
126 if (currentIndex == data.Length || (!flag && CharIsSpaceOrTab(data[currentIndex])))
127 {
128 break;
129 }
130 if (flag && data[currentIndex] == '"' && data[currentIndex - 1] == '\\')
131 {
132 stringBuilder.Append(data[currentIndex]);
133 currentIndex++;
134 }
135 }
136 if (flag)
137 {
138 currentIndex++;
139 }
140 while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex]))
141 {
142 currentIndex++;
143 }
144 if (currentIndex == data.Length)
145 {
146 parsedIndex = currentIndex;
148 }
149 if (data[currentIndex++] != ',')
150 {
151 parsedIndex = currentIndex;
152 return null;
153 }
154 while (currentIndex < data.Length && CharIsSpaceOrTab(data[currentIndex]))
155 {
156 currentIndex++;
157 }
158 parsedIndex = currentIndex;
160 }
161
162 private void Parse(string challenge)
163 {
164 int parsedIndex = 0;
165 while (parsedIndex < challenge.Length)
166 {
168 if (!string.IsNullOrEmpty(nextKey) && parsedIndex < challenge.Length)
169 {
171 if (nextValue != null && (!(nextValue == string.Empty) || nextKey.Equals("opaque", StringComparison.OrdinalIgnoreCase) || nextKey.Equals("domain", StringComparison.OrdinalIgnoreCase) || nextKey.Equals("realm", StringComparison.OrdinalIgnoreCase)))
172 {
174 continue;
175 }
176 break;
177 }
178 break;
179 }
180 }
181 }
182
183 private static readonly int[] s_alphaNumChooser = new int[3] { 48, 65, 97 };
184
185 private static volatile int s_usePortInSpn = -1;
186
187 private static bool UsePortInSpn
188 {
189 get
190 {
191 int num = s_usePortInSpn;
192 if (num != -1)
193 {
194 return num != 0;
195 }
196 if (AppContext.TryGetSwitch("System.Net.Http.UsePortInSpn", out var isEnabled))
197 {
198 s_usePortInSpn = (isEnabled ? 1 : 0);
199 }
200 else
201 {
202 string environmentVariable = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_NET_HTTP_USEPORTINSPN");
203 s_usePortInSpn = ((environmentVariable != null && (environmentVariable == "1" || environmentVariable.Equals("true", StringComparison.OrdinalIgnoreCase))) ? 1 : 0);
204 }
205 return s_usePortInSpn != 0;
206 }
207 }
208
222
224 {
225 if (response.StatusCode != HttpStatusCode.Unauthorized)
226 {
227 return false;
228 }
231 {
232 if (StringComparer.OrdinalIgnoreCase.Equals("Negotiate", item.Scheme) || StringComparer.OrdinalIgnoreCase.Equals("NTLM", item.Scheme))
233 {
234 return true;
235 }
236 }
237 return false;
238 }
239
241 {
244 {
245 return false;
246 }
247 NetworkCredential credential = credentials.GetCredential(uri, scheme);
248 if (credential == null)
249 {
250 if (System.Net.NetEventSource.Log.IsEnabled())
251 {
252 System.Net.NetEventSource.AuthenticationInfo(uri, "Authentication scheme '" + scheme + "' supported by server, but not by client.");
253 }
254 return false;
255 }
257 if (System.Net.NetEventSource.Log.IsEnabled())
258 {
259 System.Net.NetEventSource.AuthenticationInfo(uri, "Authentication scheme '" + scheme + "' selected. Client username=" + challenge.Credential.UserName);
260 }
261 return true;
262 }
263
282
284 {
285 challengeData = null;
287 {
288 return false;
289 }
291 {
292 return false;
293 }
294 return true;
295 }
296
298 {
299 if (!isProxyAuth)
300 {
301 return response.StatusCode == HttpStatusCode.Unauthorized;
302 }
303 return response.StatusCode == HttpStatusCode.ProxyAuthenticationRequired;
304 }
305
307 {
308 if (!isProxyAuth)
309 {
310 return response.Headers.WwwAuthenticate;
311 }
312 return response.Headers.ProxyAuthenticate;
313 }
314
316 {
317 if (isProxyAuth)
318 {
319 request.Headers.ProxyAuthorization = headerValue;
320 }
321 else
322 {
323 request.Headers.Authorization = headerValue;
324 }
325 }
326
328 {
329 string s = ((!string.IsNullOrEmpty(credential.Domain)) ? (credential.Domain + "\\" + credential.UserName + ":" + credential.Password) : (credential.UserName + ":" + credential.Password));
330 string parameter = Convert.ToBase64String(Encoding.UTF8.GetBytes(s));
332 }
333
335 {
337 if (string.IsNullOrEmpty(text))
338 {
339 if (System.Net.NetEventSource.Log.IsEnabled())
340 {
341 System.Net.NetEventSource.AuthenticationError(request.RequestUri, "Unable to find 'Digest' authentication token when authenticating with " + (isProxyAuth ? "proxy" : "server"));
342 }
343 return false;
344 }
347 return true;
348 }
349
351 {
352 if (!isProxyAuth)
353 {
354 return pool.SendWithProxyAuthAsync(request, async, doRequestAuth, cancellationToken);
355 }
356 return pool.SendWithVersionDetectionAndRetryAsync(request, async, doRequestAuth, cancellationToken);
357 }
358
360 {
361 bool performedBasicPreauth = false;
362 if (preAuthenticate)
363 {
365 lock (pool.PreAuthCredentials)
366 {
367 credential = pool.PreAuthCredentials.GetCredential(authUri, "Basic");
368 }
369 if (credential != null)
370 {
373 }
374 }
377 {
378 switch (challenge.AuthenticationType)
379 {
380 case AuthenticationType.Digest:
381 {
384 {
385 break;
386 }
387 response.Dispose();
390 {
393 bool flag2 = flag;
394 if (flag2)
395 {
397 }
398 if (flag2)
399 {
400 response.Dispose();
402 }
403 }
404 break;
405 }
406 case AuthenticationType.Basic:
407 {
409 {
410 if (System.Net.NetEventSource.Log.IsEnabled())
411 {
412 System.Net.NetEventSource.AuthenticationError(authUri, "Pre-authentication with " + (isProxyAuth ? "proxy" : "server") + " failed.");
413 }
414 break;
415 }
416 response.Dispose();
419 if (!preAuthenticate)
420 {
421 break;
422 }
424 if (statusCode == HttpStatusCode.Unauthorized || statusCode == HttpStatusCode.ProxyAuthenticationRequired)
425 {
426 if (System.Net.NetEventSource.Log.IsEnabled())
427 {
428 System.Net.NetEventSource.AuthenticationError(authUri, "Pre-authentication with " + (isProxyAuth ? "proxy" : "server") + " failed.");
429 }
430 break;
431 }
432 lock (pool.PreAuthCredentials)
433 {
434 try
435 {
436 if (System.Net.NetEventSource.Log.IsEnabled())
437 {
438 System.Net.NetEventSource.Info(pool.PreAuthCredentials, $"Adding Basic credential to cache, uri={authUri}, username={challenge.Credential.UserName}", "SendWithAuthAsync");
439 }
440 pool.PreAuthCredentials.Add(authUri, "Basic", challenge.Credential);
441 }
442 catch (ArgumentException)
443 {
444 if (System.Net.NetEventSource.Log.IsEnabled())
445 {
446 System.Net.NetEventSource.Info(pool.PreAuthCredentials, $"Basic credential present in cache, uri={authUri}, username={challenge.Credential.UserName}", "SendWithAuthAsync");
447 }
448 }
449 }
450 break;
451 }
452 }
453 }
454 if (System.Net.NetEventSource.Log.IsEnabled() && response.StatusCode == HttpStatusCode.Unauthorized)
455 {
456 System.Net.NetEventSource.AuthenticationError(authUri, (isProxyAuth ? "Proxy" : "Server") + " authentication failed.");
457 }
458 return response;
459 }
460
465
470
472 {
474 string algorithm;
475 bool isAlgorithmSpecified = digestResponse.Parameters.TryGetValue("algorithm", out algorithm);
477 {
478 if (!algorithm.Equals("SHA-256", StringComparison.OrdinalIgnoreCase) && !algorithm.Equals("MD5", StringComparison.OrdinalIgnoreCase) && !algorithm.Equals("SHA-256-sess", StringComparison.OrdinalIgnoreCase) && !algorithm.Equals("MD5-sess", StringComparison.OrdinalIgnoreCase))
479 {
480 if (System.Net.NetEventSource.Log.IsEnabled())
481 {
482 System.Net.NetEventSource.Error(digestResponse, $"Algorithm not supported: {algorithm}", "GetDigestTokenForCredential");
483 }
484 return null;
485 }
486 }
487 else
488 {
489 algorithm = "MD5";
490 }
491 if (!digestResponse.Parameters.TryGetValue("nonce", out var nonce))
492 {
493 if (System.Net.NetEventSource.Log.IsEnabled())
494 {
495 System.Net.NetEventSource.Error(digestResponse, "Nonce missing", "GetDigestTokenForCredential");
496 }
497 return null;
498 }
499 digestResponse.Parameters.TryGetValue("opaque", out var opaque);
500 if (!digestResponse.Parameters.TryGetValue("realm", out var value))
501 {
502 if (System.Net.NetEventSource.Log.IsEnabled())
503 {
504 System.Net.NetEventSource.Error(digestResponse, "Realm missing", "GetDigestTokenForCredential");
505 }
506 return null;
507 }
508 if (digestResponse.Parameters.TryGetValue("userhash", out var value2) && value2 == "true")
509 {
510 sb.AppendKeyValue("username", ComputeHash(credential.UserName + ":" + value, algorithm));
511 sb.AppendKeyValue("userhash", value2, includeQuotes: false);
512 }
514 {
515 string value3 = HeaderUtilities.Encode5987(credential.UserName);
516 sb.AppendKeyValue("username*", value3, includeQuotes: false);
517 }
518 else
519 {
520 sb.AppendKeyValue("username", credential.UserName);
521 }
522 sb.AppendKeyValue("realm", value);
523 sb.AppendKeyValue("nonce", nonce);
524 sb.AppendKeyValue("uri", request.RequestUri.PathAndQuery);
525 string qop = "auth";
526 bool isQopSpecified = digestResponse.Parameters.ContainsKey("qop");
527 if (isQopSpecified)
528 {
529 int num = digestResponse.Parameters["qop"].IndexOf("auth-int", StringComparison.Ordinal);
530 if (num != -1)
531 {
532 int num2 = digestResponse.Parameters["qop"].IndexOf("auth", StringComparison.Ordinal);
533 if (num2 == num)
534 {
535 num2 = digestResponse.Parameters["qop"].IndexOf("auth", num + "auth-int".Length, StringComparison.Ordinal);
536 if (num2 == -1)
537 {
538 qop = "auth-int";
539 }
540 }
541 }
542 }
544 string a1 = credential.UserName + ":" + value + ":" + credential.Password;
545 if (algorithm.EndsWith("sess", StringComparison.OrdinalIgnoreCase))
546 {
547 a1 = ComputeHash(a1, algorithm) + ":" + nonce + ":" + cnonce;
548 }
549 string a2 = request.Method.Method + ":" + request.RequestUri.PathAndQuery;
550 if (qop == "auth-int")
551 {
552 string text = ((request.Content != null) ? (await request.Content.ReadAsStringAsync().ConfigureAwait(continueOnCapturedContext: false)) : string.Empty);
553 string data = text;
554 a2 = a2 + ":" + ComputeHash(data, algorithm);
555 }
556 string value4 = ((!isQopSpecified) ? ComputeHash(ComputeHash(a1, algorithm) + ":" + nonce + ":" + ComputeHash(a2, algorithm), algorithm) : ComputeHash(ComputeHash(a1, algorithm) + ":" + nonce + ":00000001:" + cnonce + ":" + qop + ":" + ComputeHash(a2, algorithm), algorithm));
557 sb.AppendKeyValue("response", value4, includeQuotes: true, opaque != null || isAlgorithmSpecified || isQopSpecified);
558 if (opaque != null)
559 {
560 sb.AppendKeyValue("opaque", opaque, includeQuotes: true, isAlgorithmSpecified || isQopSpecified);
561 }
563 {
564 sb.AppendKeyValue("algorithm", algorithm, includeQuotes: false, isQopSpecified);
565 }
566 if (isQopSpecified)
567 {
568 sb.AppendKeyValue("qop", qop, includeQuotes: false);
569 sb.AppendKeyValue("nc", "00000001", includeQuotes: false);
570 sb.AppendKeyValue("cnonce", cnonce, includeQuotes: true, includeComma: false);
571 }
573 }
574
576 {
577 if (digestResponse.Parameters.TryGetValue("stale", out var value))
578 {
579 return value == "true";
580 }
581 return false;
582 }
583
584 private static string GetRandomAlphaNumericString()
585 {
586 Span<byte> data = stackalloc byte[32];
589 int num = 0;
590 while (num < data.Length)
591 {
592 int num2 = data[num++] % 3;
593 int num3 = data[num++] % ((num2 == 0) ? 10 : 26);
594 stringBuilder.Append((char)(s_alphaNumChooser[num2] + num3));
595 }
597 }
598
599 private static string ComputeHash(string data, string algorithm)
600 {
601 using HashAlgorithm hashAlgorithm = (algorithm.StartsWith("SHA-256", StringComparison.OrdinalIgnoreCase) ? ((HashAlgorithm)SHA256.Create()) : ((HashAlgorithm)MD5.Create()));
602 Span<byte> span = stackalloc byte[hashAlgorithm.HashSize / 8];
603 int bytesWritten;
604 bool flag = hashAlgorithm.TryComputeHash(Encoding.UTF8.GetBytes(data), span, out bytesWritten);
606 }
607
609 {
610 if (!isProxyAuth)
611 {
612 return pool.SendWithNtProxyAuthAsync(connection, request, async, cancellationToken);
613 }
614 return connection.SendAsyncCore(request, async, cancellationToken);
615 }
616
618 {
619 if (!response.Headers.TryGetValues(KnownHeaders.ProxySupport.Descriptor, out var values))
620 {
621 return false;
622 }
623 foreach (string item in values)
624 {
625 if (item == "Session-Based-Authentication")
626 {
627 return true;
628 }
629 }
630 return false;
631 }
632
634 {
637 {
638 if (System.Net.NetEventSource.Log.IsEnabled())
639 {
640 System.Net.NetEventSource.Error(connection, $"Proxy doesn't support connection-based auth, uri={authUri}", "SendWithNtAuthAsync");
641 }
642 return response;
643 }
644 if (TryGetAuthenticationChallenge(response, isProxyAuth, authUri, credentials, out var challenge) && (challenge.AuthenticationType == AuthenticationType.Negotiate || challenge.AuthenticationType == AuthenticationType.Ntlm))
645 {
646 bool isNewConnection = false;
647 bool needDrain = true;
648 try
649 {
650 if (response.Headers.ConnectionClose.GetValueOrDefault())
651 {
652 connection.DetachFromPool();
653 connection = await connectionPool.CreateHttp11ConnectionAsync(request, async, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
654 connection.Acquire();
655 isNewConnection = true;
656 needDrain = false;
657 }
658 if (System.Net.NetEventSource.Log.IsEnabled())
659 {
660 System.Net.NetEventSource.Info(connection, $"Authentication: {challenge.AuthenticationType}, Uri: {authUri.AbsoluteUri}", "SendWithNtAuthAsync");
661 }
662 string text;
663 if (!isProxyAuth && request.HasHeaders && request.Headers.Host != null)
664 {
665 text = request.Headers.Host;
666 if (System.Net.NetEventSource.Log.IsEnabled())
667 {
668 System.Net.NetEventSource.Info(connection, $"Authentication: {challenge.AuthenticationType}, Host: {text}", "SendWithNtAuthAsync");
669 }
670 }
671 else
672 {
673 UriHostNameType hostNameType = authUri.HostNameType;
674 text = ((hostNameType != UriHostNameType.IPv6 && hostNameType != UriHostNameType.IPv4) ? (await Dns.GetHostEntryAsync(authUri.IdnHost, cancellationToken).ConfigureAwait(continueOnCapturedContext: false)).HostName : authUri.IdnHost);
675 if (!isProxyAuth && !authUri.IsDefaultPort && UsePortInSpn)
676 {
681 handler.AppendFormatted(text);
682 handler.AppendLiteral(":");
683 handler.AppendFormatted(authUri.Port);
684 text = string.Create(provider, initialBuffer, ref handler);
685 }
686 }
687 string text2 = "HTTP/" + text;
688 if (System.Net.NetEventSource.Log.IsEnabled())
689 {
690 System.Net.NetEventSource.Info(connection, $"Authentication: {challenge.AuthenticationType}, SPN: {text2}", "SendWithNtAuthAsync");
691 }
693 System.Net.NTAuthentication authContext = new System.Net.NTAuthentication(isServer: false, challenge.SchemeName, challenge.Credential, text2, System.Net.ContextFlagsPal.Connection | System.Net.ContextFlagsPal.AcceptStream, channelBinding);
694 string challengeData = challenge.ChallengeData;
695 try
696 {
697 while (true)
698 {
699 string challengeResponse = authContext.GetOutgoingBlob(challengeData);
700 if (challengeResponse != null)
701 {
702 if (needDrain)
703 {
705 }
709 {
710 needDrain = true;
711 continue;
712 }
713 break;
714 }
715 break;
716 }
717 }
718 finally
719 {
720 authContext.CloseContext();
721 }
722 }
723 finally
724 {
725 if (isNewConnection)
726 {
727 connection.Release();
728 }
729 }
730 }
731 return response;
732 }
733
738
743}
static bool TryGetSwitch(string switchName, out bool isEnabled)
Definition AppContext.cs:74
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static string ToBase64String(byte[] inArray)
Definition Convert.cs:2675
static ? string GetEnvironmentVariable(string variable)
static unsafe string ToString(ReadOnlySpan< byte > bytes, Casing casing=Casing.Upper)
static Task< IPHostEntry > GetHostEntryAsync(string hostNameOrAddress)
Definition Dns.cs:93
readonly Dictionary< string, string > Parameters
string GetNextKey(string data, int currentIndex, out int parsedIndex)
string GetNextValue(string data, int currentIndex, bool expectQuotes, out int parsedIndex)
static async ValueTask< HttpResponseMessage > SendWithAuthAsync(HttpRequestMessage request, Uri authUri, bool async, ICredentials credentials, bool preAuthenticate, bool isProxyAuth, bool doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
static bool IsAuthenticationChallenge(HttpResponseMessage response, bool isProxyAuth)
static string ComputeHash(string data, string algorithm)
static void SetBasicAuthToken(HttpRequestMessage request, NetworkCredential credential, bool isProxyAuth)
static ValueTask< HttpResponseMessage > SendWithRequestAuthAsync(HttpRequestMessage request, bool async, ICredentials credentials, bool preAuthenticate, HttpConnectionPool pool, CancellationToken cancellationToken)
static ValueTask< HttpResponseMessage > InnerSendAsync(HttpRequestMessage request, bool async, bool isProxyAuth, bool doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
static bool IsServerNonceStale(DigestResponse digestResponse)
static Task< HttpResponseMessage > SendWithNtProxyAuthAsync(HttpRequestMessage request, Uri proxyUri, bool async, ICredentials proxyCredentials, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken)
static HttpHeaderValueCollection< AuthenticationHeaderValue > GetResponseAuthenticationHeaderValues(HttpResponseMessage response, bool isProxyAuth)
static bool TryGetAuthenticationChallenge(HttpResponseMessage response, bool isProxyAuth, Uri authUri, ICredentials credentials, out AuthenticationChallenge challenge)
static async Task< string > GetDigestTokenForCredential(NetworkCredential credential, HttpRequestMessage request, DigestResponse digestResponse)
static async Task< HttpResponseMessage > SendWithNtAuthAsync(HttpRequestMessage request, Uri authUri, bool async, ICredentials credentials, bool isProxyAuth, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken)
static Task< HttpResponseMessage > InnerSendAsync(HttpRequestMessage request, bool async, bool isProxyAuth, HttpConnectionPool pool, HttpConnection connection, CancellationToken cancellationToken)
static bool TryGetChallengeDataForScheme(string scheme, HttpHeaderValueCollection< AuthenticationHeaderValue > authenticationHeaderValues, out string challengeData)
static void SetRequestAuthenticationHeaderValue(HttpRequestMessage request, AuthenticationHeaderValue headerValue, bool isProxyAuth)
static Task< HttpResponseMessage > SendWithNtConnectionAuthAsync(HttpRequestMessage request, bool async, ICredentials credentials, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken)
static ValueTask< HttpResponseMessage > SendWithProxyAuthAsync(HttpRequestMessage request, Uri proxyUri, bool async, ICredentials proxyCredentials, bool doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
static bool TryGetValidAuthenticationChallengeForScheme(string scheme, AuthenticationType authenticationType, Uri uri, ICredentials credentials, HttpHeaderValueCollection< AuthenticationHeaderValue > authenticationHeaderValues, out AuthenticationChallenge challenge)
static bool IsSessionAuthenticationChallenge(HttpResponseMessage response)
static bool TryGetRepeatedChallenge(HttpResponseMessage response, string scheme, bool isProxyAuth, out string challengeData)
static async ValueTask< bool > TrySetDigestAuthToken(HttpRequestMessage request, NetworkCredential credential, DigestResponse digestResponse, bool isProxyAuth)
static bool ProxySupportsConnectionAuth(HttpResponseMessage response)
static bool ContainsNonAscii(string input)
static string Encode5987(string input)
static readonly KnownHeader ProxySupport
async Task< HttpResponseMessage > SendAsyncCore(HttpRequestMessage request, bool async, CancellationToken cancellationToken)
async ValueTask DrainResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void AuthenticationError(Uri uri, string message)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static void AuthenticationInfo(Uri uri, string message)
ChannelBinding? GetChannelBinding(ChannelBindingKind kind)
static new MD5 Create()
Definition MD5.cs:57
static new SHA256 Create()
Definition SHA256.cs:55
static StringComparer OrdinalIgnoreCase
static Encoding UTF8
Definition Encoding.cs:526
static string GetStringAndRelease(StringBuilder sb)
static StringBuilder Acquire(int capacity=16)
AuthenticationChallenge(AuthenticationType authenticationType, string schemeName, NetworkCredential credential, string challenge)