Skip to content

SNOW-2865734: Fix unnecessary token caching and username_password_mfa auth#997

Merged
sfc-gh-pbulawa merged 2 commits intomasterfrom
SNOW-2865734
Mar 19, 2026
Merged

SNOW-2865734: Fix unnecessary token caching and username_password_mfa auth#997
sfc-gh-pbulawa merged 2 commits intomasterfrom
SNOW-2865734

Conversation

@sfc-gh-pbulawa
Copy link
Collaborator

This pull request fixes the missing authenticator type for username/password with MFA token caching (SF_AUTHENTICATOR_USR_PWD_MFA) and adds comprehensive tests to verify its behavior. It ensures that MFA tokens are only cached for this authenticator and not for the default username/password authentication. The changes include updates to the core logic, constants, and test suites.

Authenticator logic and constants:

  • Added the SF_AUTHENTICATOR_USR_PWD_MFA constant in snowflake/client.h and updated Authenticator.cpp to recognize it, mapping it to the AUTH_USR_PWD_MFA type.
  • Updated authentication and secure storage logic to handle AUTH_USR_PWD_MFA separately, ensuring MFA token caching only applies to this type and not to the default authenticator.

Testing enhancements:

  • Added two new test suites: test_usr_pwd_mfa (for MFA token caching) and test_default_auth (for default auth without MFA token caching), with corresponding CMake configurations and Wiremock login responses.
  • Implemented tests in test_usr_pwd_mfa.cpp to verify successful connection and correct MFA token caching behavior for the new authenticator.
  • Implemented tests in test_default_auth.cpp to ensure that MFA tokens are not cached for default username/password authentication.

@sfc-gh-pbulawa sfc-gh-pbulawa requested a review from a team as a code owner March 18, 2026 10:24
@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.84%. Comparing base (b282949) to head (80a72da).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #997      +/-   ##
==========================================
+ Coverage   80.74%   80.84%   +0.10%     
==========================================
  Files         137      137              
  Lines       12077    12078       +1     
==========================================
+ Hits         9751     9764      +13     
+ Misses       2326     2314      -12     

☔ 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.

@sfc-gh-pbulawa sfc-gh-pbulawa merged commit 331bb60 into master Mar 19, 2026
71 of 73 checks passed
@sfc-gh-pbulawa sfc-gh-pbulawa deleted the SNOW-2865734 branch March 19, 2026 11:58
@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants