Commit 10c3bf9
authored
Add host discovery to login.databricks.com flow (#4829)
## Why
The discovery login flow via `login.databricks.com` (PR #4702) is a
separate code path from the regular `--host` login. After #4809 added
SPOG host detection via `.well-known/databricks-config` to the regular
login path, the discovery flow was missing this behavior. Profiles
created via `login.databricks.com` for SPOG hosts had no `account_id`
and no discovery metadata, which breaks re-authentication (because
`ToOAuthArgument()` needs `account_id` to route to unified OAuth).
## Changes
**Before:** `discoveryLogin()` only used token introspection for
`workspace_id` and deliberately skipped saving `account_id`.
**Now:** After getting the host from `login.databricks.com`,
`discoveryLogin()` calls `runHostDiscovery()` on the discovered host to
populate `account_id`, `workspace_id`, and `DiscoveryURL` from
`.well-known/databricks-config`. Token introspection is kept as a
fallback for hosts where discovery is unavailable (e.g. classic
workspace hosts). `account_id` is now saved to the profile.
**Note:** This is not the full SPOG story for discovery login. Most SPOG
workspaces will need additional handling during the login.databricks.com
flow (e.g. workspace selection after discovery detects a multi-workspace
account). A follow-up PR will address this.
## Test plan
- New test: discovery login with SPOG host (mock
`.well-known/databricks-config`) verifies `account_id` and
`workspace_id` come from discovery
- New test: discovery login where host discovery fails verifies fallback
to introspection
- Updated existing tests to assert `account_id` is now saved
- All `go test ./cmd/auth/... ./libs/auth/...` pass
- `make checks` passes
This pull request was AI-assisted by Isaac.1 parent 42bd421 commit 10c3bf9
File tree
4 files changed
+107
-14
lines changed- acceptance/cmd/auth/login/discovery
- cmd/auth
4 files changed
+107
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
617 | 627 | | |
618 | 628 | | |
619 | 629 | | |
620 | 630 | | |
621 | 631 | | |
622 | | - | |
623 | | - | |
624 | 632 | | |
625 | 633 | | |
626 | 634 | | |
627 | 635 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
632 | 642 | | |
633 | | - | |
634 | 643 | | |
635 | 644 | | |
636 | 645 | | |
| |||
641 | 650 | | |
642 | 651 | | |
643 | 652 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
648 | 657 | | |
649 | 658 | | |
650 | 659 | | |
| |||
656 | 665 | | |
657 | 666 | | |
658 | 667 | | |
| 668 | + | |
659 | 669 | | |
660 | 670 | | |
661 | 671 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
681 | | - | |
| 681 | + | |
682 | 682 | | |
683 | 683 | | |
684 | 684 | | |
685 | 685 | | |
| 686 | + | |
686 | 687 | | |
687 | 688 | | |
688 | 689 | | |
| |||
816 | 817 | | |
817 | 818 | | |
818 | 819 | | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
819 | 897 | | |
820 | 898 | | |
821 | 899 | | |
| |||
911 | 989 | | |
912 | 990 | | |
913 | 991 | | |
| 992 | + | |
914 | 993 | | |
915 | 994 | | |
0 commit comments