Honor profile.authType in default credential chain and delegate name()#182
Open
parthban-db wants to merge 1 commit into
Open
Honor profile.authType in default credential chain and delegate name()#182parthban-db wants to merge 1 commit into
parthban-db wants to merge 1 commit into
Conversation
|
Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes. |
1 similar comment
|
Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes. |
b69fa83 to
520820d
Compare
520820d to
3d3b3ec
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.
🥞 Stacked PR
Use this link to review incremental changes.
Summary
The default credential chain now honors
profile.authType, andDefaultCredentials.name()reports the strategy that actually resolved instead of always returningdefault.Why
The chain previously tried strategies in a fixed order (PAT, OAuth M2M, Databricks CLI) and stopped at the first applicable one, ignoring
profile.authTypeeven though it is parsed fromauth_type/DATABRICKS_AUTH_TYPE. A profile that setauth_type = databricks-clibut also carried atokenwould silently use PAT, with no way to pin a method. Separately,name()was hardcoded todefault, so logging and future User-Agentauth=telemetry could never tell which strategy won.AI Generated
What changed
Strategyis now an interface{name, configure}instead of a bare function, so the chain can match a strategy againstauthTypeby name (pat,oauth-m2m,databricks-cli) before building it. ConvertedpatStrategy,m2mStrategy, andu2mStrategyto this shape with unchanged config logic.authTypeis set, the chain configures only the matching strategy with no fallback: it throwsNO_AUTH_CONFIGUREDif that strategy cannot configure, and the newAUTH_TYPE_NOT_FOUNDcode if no strategy matches. WhenauthTypeis unset, ordered fall-through behavior is unchanged.name()returnsdefaultbefore resolution and the resolved strategy's name afterward.DefaultCredentials(config/auth_default.go); the JS strategy set is smaller, so fewerauthTypenames are accepted — an existing scope difference. Composing the User-Agentauth=segment is out of scope (JS does not emit one yet).Validated:
npm run build,npm test,npm run test:browser,npm run typecheck,npm run lint, andnpm run format:checkall pass for@databricks/sdk-auth.