Skip to content

New UseHttps overload with per connection callback #33953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2021

Conversation

Tratcher
Copy link
Member

@Tratcher Tratcher commented Jun 29, 2021

Fixes #33452, contributes to #33264 (delayed client certs).

There is no new functionality here, this takes an internal API and makes it public (and more user friendly). Customers wanted this in order to A) get access to the ConnectionContext for information like the IPs, and B) to configure delayed client cert negotiation per connection.

@dotnet/aspnet-api-review having to pass the callback to the TlsHandshakeCallbackOptions constructor is inconvenient usage compared to assigning it as a property. This pattern was recommended because the callback is required. I recommend we instead validate the property is set inside the UseHttps method that takes the TlsHandshakeCallbackOptions. I removed the constructor.

Open question: Should the ServerOptionsSelectionCallback still default to AllowDelayedClientCertificateNegotation = true (new in preview6)? Or should people that want delayed client certs move to the new API? Removed. The new API will be required to opt into delayed client certs.

@Tratcher Tratcher added this to the 6.0-preview7 milestone Jun 29, 2021
@Tratcher Tratcher requested a review from halter73 June 29, 2021 23:49
@Tratcher Tratcher self-assigned this Jun 29, 2021
@Tratcher Tratcher requested a review from BrennanConroy as a code owner June 29, 2021 23:49
@ghost ghost added the area-runtime label Jun 29, 2021
@Tratcher
Copy link
Member Author

Tratcher commented Jul 7, 2021

Ping

@Tratcher Tratcher force-pushed the tratcher/tlscallback branch from ae5b25a to 9b25dae Compare July 8, 2021 18:06
@Tratcher
Copy link
Member Author

Tratcher commented Jul 8, 2021

  • Rebased.
  • Removed the TlsHandshakeCallbackOptions constructor.
  • ServerOptionsSelectionCallback no longer sets AllowDelayedClientCertificateNegotation = true.

/// <summary>
/// Information about an individual connection.
/// </summary>
public ConnectionContext Connection { get; internal set; } = default!;
Copy link
Member

Choose a reason for hiding this comment

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

👍 This resolves part of #31303 too.

The next major thing is to not break ALPN for HTTP/2 when this new UseHttps() overload is used. Exposing the ConfigureAlpn() is better than nothing, but I would prefer if it just works without needing to know to call that.

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.

Accessing Kestrel state in ServerOptionsSelectionCallback
4 participants