-
Notifications
You must be signed in to change notification settings - Fork 311
[6.1] Ensure correct SPN when calling SspiContextProvider (#3347) #3478
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
Conversation
* Reset negotiateAuth if SNI doesn't work This change also adds some book keeping to ensure we're only using the spn that has previously generated a context once one has been created. * initialization only after success * move serverSpn to be local
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.
Pull Request Overview
This PR ports changes from #3347 to the release/6.1 branch to ensure correct SPN (Service Principal Name) handling when calling SspiContextProvider. The changes improve SPN management by introducing a new data structure to hold primary and secondary SPNs and refactoring the authentication flow to use this improved approach.
- Refactors SPN handling from string arrays to a new
ResolvedServerSpn
struct that holds primary and secondary SPNs - Updates
SspiContextProvider
to pre-initialize authentication parameters with correct SPNs instead of passing them at call time - Adds proper disposal pattern for
NegotiateSspiContextProvider
to manage resources correctly
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ResolvedServerSpn.cs | New struct to encapsulate primary and secondary SPN values with detailed documentation |
SspiContextProvider.cs | Refactored to store authentication parameters during initialization and simplified API methods |
NegotiateSspiContextProvider.cs | Added IDisposable implementation and SPN validation logic |
TdsParser.cs (both versions) | Updated to use new SPN resolution approach and moved authentication provider initialization |
SniProxy.netcore.cs | Changed return type from string array to ResolvedServerSpn struct |
InstanceNameTest.cs | Updated test to work with new SPN resolution API |
SqlClientEventSource.cs | Added new overload for three-parameter state dump events |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SSPI/SspiContextProvider.cs
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.
🚀 👕
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/6.1 #3478 +/- ##
===============================================
- Coverage 68.87% 64.71% -4.17%
===============================================
Files 280 281 +1
Lines 62322 62354 +32
===============================================
- Hits 42927 40351 -2576
- Misses 19395 22003 +2608
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Ports #3347 to release/6.1