Skip to content

Conversation

@TerryHowe
Copy link
Member

Remove ForceAttemptOAuth2 and add SetLegacyMode to the auth client.

@codecov
Copy link

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.59%. Comparing base (4427369) to head (55bef2f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1038      +/-   ##
==========================================
+ Coverage   82.50%   82.59%   +0.09%     
==========================================
  Files          64       64              
  Lines        4779     4781       +2     
==========================================
+ Hits         3943     3949       +6     
+ Misses        512      509       -3     
+ Partials      324      323       -1     

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

@TerryHowe TerryHowe added the v3 Things belongs to version 3.x label Nov 13, 2025
@TerryHowe TerryHowe added this to the v3.0.0 milestone Nov 17, 2025
@Wwwsylvia Wwwsylvia requested a review from Copilot November 22, 2025 12:13
Copilot finished reviewing on behalf of Wwwsylvia November 22, 2025 12:15
Copy link
Contributor

Copilot AI left a 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 refactors the authentication client API by replacing the public ForceAttemptOAuth2 field with a private legacyMode field and introducing a new SetLegacyMode method. The default authentication behavior changes from using the legacy distribution spec to using OAuth2 with password grant.

Key changes:

  • Replaced public ForceAttemptOAuth2 boolean field with private legacyMode field and SetLegacyMode(bool) method
  • Inverted default behavior: OAuth2 is now the default instead of legacy distribution spec
  • Updated all tests to use the new API pattern

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
registry/remote/auth/client.go Replaced ForceAttemptOAuth2 field with legacyMode field, added SetLegacyMode method, and inverted the authentication logic to make OAuth2 the default
registry/remote/auth/client_test.go Removed ForceAttemptOAuth2: true from OAuth2 tests (now use default), added SetLegacyMode(true) calls to legacy distribution spec tests
registry/remote/auth/example_test.go Removed ForceAttemptOAuth2: true from example to use the new OAuth2 default behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TerryHowe TerryHowe force-pushed the feature-remove-force-auth branch 2 times, most recently from 989f536 to eb3124f Compare November 22, 2025 12:41
@TerryHowe TerryHowe force-pushed the feature-remove-force-auth branch from eb3124f to 989f67e Compare November 22, 2025 13:20
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

Since we are now in v3 development, should we just remove ForceAttemptOAuth2?

@shizhMSFT shizhMSFT changed the title feature: remove ForceAttemptOAuth2 add SetLegacyMode to auth client feat: remove ForceAttemptOAuth2 add SetLegacyMode to auth client Nov 22, 2025
@TerryHowe
Copy link
Member Author

Since we are now in v3 development, should we just remove ForceAttemptOAuth2?

This pull request does remove ForceAttemptOAuth2 I don't think that will have a big impact on users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 Things belongs to version 3.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants