Simplify HttpsConnectionMiddleware by using ServerOptionsSelectionCallback everywhere
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
Now that https://github.com/dotnet/runtime/issues/40402 is resolved, we should try always calling `SslStream.AuthenticateAsServerAsync(ServerOptionsSelectionCallback, object?, CancellationToken)` like we do for `UseHttps(TlsHandshakeCallbackOptions)` even when using the older `UseHttps(HttpsConnectionAdapterOptions)` overloads.
This should simplify the codebase and make it less likely that we have divergent behavior for different UseHttps overloads. I wanted to do this initially, but I didn't want to regress the behavior of the older overloads when dealing with client certificates.
As part of this, we should always add SslStream to the ConnectionContext (this only happens for the new overload or if `HttpsConnectionAdapterOptions.ServerCertificateSelector` is set today) and we should always configure `TlsConnectionFeature.HostName`. We might also want to look at making HostName accessible via an interface. Currently, it's only used for event source logging
@shirhatti @Tratcher
Contributor guide
Assessment
This issue has not been assessed yet.