Skip to content

Use TLS channel binding in Negotiate authentication - #68317

Merged
DeagleGross merged 3 commits into
dotnet:mainfrom
DeagleGross:deaglegross-negotiate-tls-channel-binding
Aug 13, 2026
Merged

Use TLS channel binding in Negotiate authentication#68317
DeagleGross merged 3 commits into
dotnet:mainfrom
DeagleGross:deaglegross-negotiate-tls-channel-binding

Conversation

@DeagleGross

@DeagleGross DeagleGross commented Aug 10, 2026

Copy link
Copy Markdown
Member
  • pass Kestrel's TLS endpoint channel binding token to managed NegotiateAuthentication contexts
  • keep the owned channel binding alive for connection-scoped multi-round NTLM/Kerberos exchanges
  • preserve existing behavior for non-HTTPS requests, unavailable channel bindings, and IIS/HTTP.sys server-integrated authentication deferral
  • add focused tests for token forwarding, fallback behavior, multi-round state reuse, and channel binding ownership

Resolves #68315

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@DeagleGross
DeagleGross requested a review from halter73 as a code owner August 10, 2026 11:48
Copilot AI lite review requested due to automatic review settings August 10, 2026 11:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Negotiate authentication handler to forward the TLS endpoint channel binding token (CBT) into managed NegotiateAuthentication so that NTLM/Kerberos over HTTPS can be cryptographically bound to the underlying TLS channel, and ensures the CBT’s lifetime is preserved across multi-round handshakes.

Changes:

  • Pass ITlsConnectionFeature endpoint CBT bytes into the connection-scoped Negotiate state at creation time.
  • Introduce an owned ChannelBinding implementation (NegotiateChannelBinding) and ensure it is disposed with the Negotiate state.
  • Add/extend tests to validate CBT forwarding, fallback behavior when CBT is unavailable, and reuse across multi-round exchanges.
Show a summary per file
File Description
src/Security/Authentication/Negotiate/src/NegotiateHandler.cs Reads TLS endpoint CBT (when available) and passes it into state creation.
src/Security/Authentication/Negotiate/src/Internal/INegotiateStateFactory.cs Extends the factory contract to accept a CBT payload.
src/Security/Authentication/Negotiate/src/Internal/NegotiateStateFactory.cs Forwards CBT into NegotiateState.
src/Security/Authentication/Negotiate/src/Internal/NegotiateState.cs Creates NegotiateAuthentication with a ChannelBinding and owns/disposes it.
src/Security/Authentication/Negotiate/src/Internal/NegotiateChannelBinding.cs New owned ChannelBinding implementation that copies CBT bytes into unmanaged memory.
src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateHandlerTests.cs Adds tests for CBT behavior and extends the test connection to expose TLS feature behavior.
src/Security/Authentication/Negotiate/test/Negotiate.Test/NegotiateChannelBindingTests.cs New unit test verifying CBT bytes are copied/owned by NegotiateChannelBinding.
src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs Updates the test factory implementation for the new CBT-aware signature.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 8/8 changed files
  • Comments generated: 1
  • Review effort level: Lite

@DeagleGross DeagleGross self-assigned this Aug 10, 2026
@DeagleGross DeagleGross added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Aug 10, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread src/Security/Authentication/Negotiate/src/Internal/NegotiateChannelBinding.cs Outdated
Comment thread src/Security/Authentication/Negotiate/src/NegotiateHandler.cs Outdated

@Youssef1313 Youssef1313 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only reviewed the last commit. Previous commits previously approved by @BrennanConroy.

@DeagleGross
DeagleGross merged commit 704fddd into dotnet:main Aug 13, 2026
25 checks passed
@DeagleGross
DeagleGross deleted the deaglegross-negotiate-tls-channel-binding branch August 13, 2026 08:02
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use TLS channel binding tokens in NegotiateHandler

4 participants