Skip to content

Possible bug in AuthenticationHelper #36644

@ymassad

Description

@ymassad

I think that there might be a bug in the following file:

https://github.com/dotnet/runtime/blob/master/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/AuthenticationHelper.NtAuth.cs

Lines 100-118 is where the Spn is being calculated.

It seems that the port is not taken into account when calculating the spn.

That is, you get something like HTTP/machine.domain.lab instead of HTTP/machine.domain.lab:5000

The reason I am posting this is that I am troubleshooting a WCF client problem that happens in .NET Core but not in .NET framework.

The Spn I am passing to System.ServiceModel.ClientBase is being ignored. I am passing HTTP/machine.domain.lab:5000, but it seems that the code in AuthenticationHelper.NtAuth recalculates the SPN and does not use the port. This causes an exception to be thrown. The exception message is "The target principal name is incorrect". I am assuming that the SPN is the issue.

I think that another issue is the fact that the Spn I am passing from WCF is being ignored.

I am using .NET Core 3.1 and System.ServiceModel.Http 4.7.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions