Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit e2f96c8

Browse files
author
Geoff Kizer
committed
update arguments passed to NTAuthentication constructor
1 parent 0288644 commit e2f96c8

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Net.Http.Headers;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using System.Security.Authentication.ExtendedProtection;
910

1011
namespace System.Net.Http
1112
{
@@ -48,8 +49,9 @@ private static async Task<HttpResponseMessage> SendWithNtAuthAsync(HttpRequestMe
4849
{
4950
string challengeData = challenge.ChallengeData;
5051

51-
// TODO: Validate correct arguments to NTAuthentication
52-
NTAuthentication authContext = new NTAuthentication(false, challenge.SchemeName, challenge.Credential, null, ContextFlagsPal.Connection, null);
52+
string spn = "HTTP/" + authUri.IdnHost;
53+
ChannelBinding channelBinding = connection.TransportContext?.GetChannelBinding(ChannelBindingKind.Endpoint);
54+
NTAuthentication authContext = new NTAuthentication(false, challenge.SchemeName, challenge.Credential, spn, ContextFlagsPal.Connection, channelBinding);
5355
try
5456
{
5557
while (true)

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ internal partial class AuthenticationHelper
1212
{
1313
private const string BasicScheme = "Basic";
1414
private const string DigestScheme = "Digest";
15-
private const string NtlmScheme = "ntlm";
16-
private const string NegotiateScheme = "negotiate";
15+
private const string NtlmScheme = "NTLM";
16+
private const string NegotiateScheme = "Negotiate";
1717

1818
private enum AuthenticationType
1919
{
20-
None,
2120
Basic,
2221
Digest,
2322
Ntlm,

src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ public bool CanRetry
152152

153153
public DateTimeOffset CreationTime { get; } = DateTimeOffset.UtcNow;
154154

155+
public TransportContext TransportContext => _transportContext;
156+
155157
private int ReadBufferSize => _readBuffer.Length;
156158

157159
private ReadOnlyMemory<byte> RemainingBuffer => new ReadOnlyMemory<byte>(_readBuffer, _readOffset, _readLength - _readOffset);

0 commit comments

Comments
 (0)