Wire profile name through CLI ToOAuthArgument for profile-based cache keys#4562
Open
simonfaltum wants to merge 1 commit intomainfrom
Open
Wire profile name through CLI ToOAuthArgument for profile-based cache keys#4562simonfaltum wants to merge 1 commit intomainfrom
simonfaltum wants to merge 1 commit intomainfrom
Conversation
The SDK supports profile-based OAuth token cache keys via NewProfile* constructors, but the CLI always used NewBasic* constructors which never pass the profile name through. This meant profile-based cache keys were never used end-to-end. Add a Profile field to AuthArguments and switch ToOAuthArgument() from NewBasic* to NewProfile* constructors. Wire the profile name from cmd/auth/token.go and cmd/auth/login.go into AuthArguments before calling ToOAuthArgument(). When Profile is empty (no profile specified), behavior is unchanged since NewProfile* with empty string falls back to host-based keys.
Collaborator
|
Commit: b592eb6
15 interesting tests: 7 KNOWN, 7 SKIP, 1 flaky
Top 20 slowest tests (at least 2 minutes):
|
cc2ddb3 to
b592eb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Profilefield toAuthArgumentsstruct inlibs/auth/arguments.go.ToOAuthArgument()fromNewBasic*toNewProfile*constructors, passing the profile name so the SDK uses profile-based cache keys when a profile is specified.cmd/auth/token.goandcmd/auth/login.gointoAuthArgumentsbefore callingToOAuthArgument().Why
The SDK already supports profile-based OAuth token cache keys, but the CLI never passes the profile name through to the SDK constructors. This means
auth token --profile Xandauth login --profile Xstill use host-based cache keys, making profile-based caching a no-op. This is a prerequisite for profile-based cache keys to work end-to-end.Tests
libs/auth,cmd/auth)token_test.goin-memory cache with profile-based entriescmd/auth/*)make checkspassesTested manually by creating two profiles that were with the same host.
Results:
Two profiles, same host, different tokens with different expiry times. That's the whole point of this change — before, they'd share one cache entry keyed by https://e2-dogfood.staging.cloud.databricks.com and one login would clobber the other. Now they each get their own entry keyed by profile name.