feat!: remove ForceAttemptOAuth2 add SetLegacyMode to auth client#1038
feat!: remove ForceAttemptOAuth2 add SetLegacyMode to auth client#1038TerryHowe wants to merge 4 commits intooras-project:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
=======================================
Coverage 82.54% 82.55%
=======================================
Files 64 64
Lines 4779 4781 +2
=======================================
+ Hits 3945 3947 +2
- Misses 510 511 +1
+ Partials 324 323 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
ForceAttemptOAuth2boolean field with privatelegacyModefield andSetLegacyMode(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.
989f536 to
eb3124f
Compare
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
eb3124f to
989f67e
Compare
shizhMSFT
left a comment
There was a problem hiding this comment.
Since we are now in v3 development, should we just remove ForceAttemptOAuth2?
This pull request does remove |
| // - https://distribution.github.io/distribution/spec/auth/jwt/ | ||
| // - https://distribution.github.io/distribution/spec/auth/oauth/ | ||
| ForceAttemptOAuth2 bool | ||
| legacyMode bool |
There was a problem hiding this comment.
If we do want legacyMode, why not make it an exported field like LegacyMode so that we don't need getter and setter.
…egacyMode to auth client Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Remove ForceAttemptOAuth2 and add SetLegacyMode to the auth client.