Skip to content

Expose SSPI context provider as public #2494

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

twsouthwick
Copy link
Member

@twsouthwick twsouthwick commented May 8, 2024

This change:

  • Adds a property to SqlConnection to allow setting a provider
  • Plumbs that property into the TdsParser so that it can be used if set

Fixes #2253

@twsouthwick twsouthwick changed the title Expose SSPI context provider as public Expose SSPI context provider as public May 8, 2024
@twsouthwick twsouthwick force-pushed the public branch 3 times, most recently from e16f2c8 to cfcf164 Compare March 3, 2025 19:42
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 73.91304% with 12 lines in your changes missing coverage. Please review.

Project coverage is 59.53%. Comparing base (b8948f2) to head (45a3228).

Files with missing lines Patch % Lines
...core/src/Microsoft/Data/SqlClient/SqlConnection.cs 54.54% 5 Missing ⚠️
...etfx/src/Microsoft/Data/SqlClient/SqlConnection.cs 54.54% 5 Missing ⚠️
...nt/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs 0.00% 1 Missing ⚠️
...a/SqlClient/ConnectionPool/SqlConnectionPoolKey.cs 87.50% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (b8948f2) and HEAD (45a3228). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b8948f2) HEAD (45a3228)
addons 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2494      +/-   ##
==========================================
- Coverage   67.04%   59.53%   -7.52%     
==========================================
  Files         300      294       -6     
  Lines       65376    65088     -288     
==========================================
- Hits        43831    38748    -5083     
- Misses      21545    26340    +4795     
Flag Coverage Δ
addons ?
netcore 62.81% <78.12%> (-9.38%) ⬇️
netfx 60.79% <68.96%> (-4.40%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@benrr101 benrr101 left a comment

Choose a reason for hiding this comment

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

Overall, really like the goal and implementation. Most of my comments are style related, since I'm sure my colleagues have tackled the bigger questions.

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

Made an initial pass, and came up with some questions/comments.

@paulmedynski paulmedynski self-assigned this Apr 2, 2025
@twsouthwick twsouthwick force-pushed the public branch 6 times, most recently from 380e896 to 2039bd9 Compare May 1, 2025 19:37
Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

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

Factory vs instance in the netfx code, and a few questions about docs.

@twsouthwick twsouthwick force-pushed the public branch 2 times, most recently from 871651d to fb65437 Compare May 13, 2025 14:43
Adds a property to SqlConnection to allow setting a provider
Plumbs that property into the TdsParser so that it can be used if set

Fixes dotnet#2253
@twsouthwick twsouthwick marked this pull request as ready for review May 13, 2025 18:40
@twsouthwick twsouthwick requested a review from paulmedynski May 13, 2025 18:40
Copy link

@nhart12 nhart12 left a comment

Choose a reason for hiding this comment

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

Latest package still works for our use-case

@twsouthwick twsouthwick requested a review from a team as a code owner May 19, 2025 16:01
@twsouthwick
Copy link
Member Author

Copy link
Contributor

@mdaigle mdaigle left a comment

Choose a reason for hiding this comment

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

A few small things I'd like to see addressed. I will also leave this blocked until we complete a security review. We need to do one soon for our upcoming releases anyway.

{
conn.Open();

Assert.Fail("Expected to use custom SSPI context provider");
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to find a way to test the positive case, so that we know we can successfully connect via a custom context provider.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I struggled to figure out how to test it even for this. The main problem with a positive case is that the implementation is wildly different between frameworks so testing it starts being difficult. My thought here was to ensure it gets plumbed through, and the existing tests ensure that once it's being called that it works correctly.

If you have ideas here, please let me know how to proceed.

@twsouthwick twsouthwick requested a review from mdaigle May 21, 2025 19:55
@paulmedynski paulmedynski added this to the 7.0-preview1 milestone Jul 4, 2025
paulmedynski
paulmedynski previously approved these changes Jul 4, 2025
@paulmedynski
Copy link
Contributor

@twsouthwick - Need to resolve conflicts here, but I know @benrr101 is also working on merging the .NET and .NET Framework instances of this class, so please coordinate with him.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hook for custom SSPI context for SqlConnection instances
6 participants