Repository navigation
Commit 30afec5
authored
Skip workspace selection in auth login on account console hosts (databricks#5504)
## Why
Logging in to an account console host (for example
`https://accounts.cloud.databricks.com`) with an account ID prompted
"Select a workspace", and silently auto-selected one when the account
had exactly one workspace. These hosts only serve account-level APIs, so
the stored `workspace_id` refers to a workspace the profile can never
talk to, and later commands fail in confusing ways.
Relates to databricks#5479.
## Changes
Before, `databricks auth login --host
https://accounts.cloud.databricks.com --account-id <id>` prompted for
(or auto-selected) a workspace and wrote `workspace_id` into the
profile. Now it skips workspace selection entirely on classic account
console hosts and writes no `workspace_id` key.
`shouldPromptWorkspace` returns false when the host is a classic account
console host, using `auth.IsClassicAccountHost` on the canonical host
name (the same check `needsAccountIDPrompt` and `ToOAuthArgument`
already use). Passing `--workspace-id` explicitly (or `?w=` / `?o=` host
query params) still works and is still written to the profile. SPOG and
unified hosts keep prompting exactly as before.
## Test plan
- [x] Extended the `shouldPromptWorkspace` unit tests: classic accounts
host, accounts-dod host, host without scheme, accounts host with an
explicit workspace ID, and a workspace host that still prompts.
- [x] `go test ./cmd/auth/... ./libs/auth/...` passes.
- [x] Existing auth acceptance tests pass unchanged (`go test
./acceptance -run TestAccept/cmd/auth`). No acceptance test was added:
the harness cannot complete an OAuth challenge against an `accounts.*`
host, and the workspace selection step only runs after a successful
challenge.
- [x] `./task fmt-q`, `./task lint-q`, and `./task checks` pass.
This pull request and its description were written by Isaac.1 parent 4821c5a commit 30afec5
3 files changed
Lines changed: 39 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
419 | 423 | | |
420 | 424 | | |
421 | 425 | | |
422 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
423 | 430 | | |
424 | 431 | | |
425 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
569 | 594 | | |
570 | 595 | | |
571 | 596 | | |
| |||
0 commit comments