Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,19 @@ private static async Task<HttpResponseMessage> SendWithNtAuthAsync(HttpRequestMe
NetEventSource.Info(connection, $"Authentication: {challenge.AuthenticationType}, SPN: {spn}");
}

ContextFlagsPal contextFlags = ContextFlagsPal.Connection;
// When connecting to proxy server don't enforce the integrity to avoid
// compatibility issues. The assumption is that the proxy server comes
// from a trusted source. On macOS we always need to enforce the integrity
// to avoid the GSSAPI implementation generating corrupted authentication
// tokens.
if (!isProxyAuth || OperatingSystem.IsMacOS())
{
contextFlags |= ContextFlagsPal.InitIntegrity;
}

ChannelBinding? channelBinding = connection.TransportContext?.GetChannelBinding(ChannelBindingKind.Endpoint);
NTAuthentication authContext = new NTAuthentication(isServer: false, challenge.SchemeName, challenge.Credential, spn, ContextFlagsPal.Connection | ContextFlagsPal.InitIntegrity, channelBinding);
NTAuthentication authContext = new NTAuthentication(isServer: false, challenge.SchemeName, challenge.Credential, spn, contextFlags, channelBinding);
string? challengeData = challenge.ChallengeData;
try
{
Expand Down