-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
add ServerOptionsSelectionCallback to SslStream #38760
Conversation
Tagging subscribers to this area: @dotnet/ncl |
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Implementation.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslAuthenticationOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/tests/FunctionalTests/ServerAsyncAuthenticateTest.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just nits, otherwise this looks good.
src/libraries/System.Net.Security/src/System/Net/Security/SslAuthenticationOptions.cs
Outdated
Show resolved
Hide resolved
internal object? UserState { get; set; } | ||
internal ServerOptionsSelectionCallback? ServerOptionDelegate { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these ever set outside of the ctor? Looks like they can be made read-only.
This add asynchronous callback to select session properties based on name requested by client. This allow more customization besides server certificate as well as it allows async work.
Nature place for this would be AcquireServerCredentials() with other callback. But that code is far off from the async path.
So instead I hook it ion place where we get SNI info from the client hello. That is very early before we do any real work so it seems like a good fit.
So far I added one few basic tests. I want to add more using new stranger where we generate certificates but that seems to have some issues on windows. I will fix that as part of #35844 and I will leave #31097 open as reminder to add more tests.
In the mean time, this should allow Kestrel and YARP to consume new API.
contributes to #31097
contributes to #37933