Repository navigation
Expand file tree
/
Copy pathscript
More file actions
70 lines (54 loc) · 4.09 KB
/
Copy pathscript
File metadata and controls
70 lines (54 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
sethome "./home"
title "Device code login is disabled by default\n"
(
unset DATABRICKS_CLI_DEVICE_CODE
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
)
title "Flags the non-interactive login cannot honor\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --configure-cluster
# The non-interactive login cannot answer the profile picker or the host prompt.
title "Missing host\n"
trace musterr $CLI auth login --use-device-code
trace musterr $CLI auth login --profile test --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
title "Incomplete flags of the second step\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --confirmation-code FTFA-QQKY
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --user-code WDJB-0001 --confirmation-code FTFA-QQKY
title "Profile name that marks a pending login\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile 'test#device-code' --use-device-code
title "Account host\n"
trace musterr $CLI auth login --host https://accounts.cloud.databricks.test --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
envsubst < "./home/.databrickscfg.tmpl" > "./home/.databrickscfg"
title "Profile scoped to resources\n"
trace musterr $CLI auth login --profile resources --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
title "No pending login\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
trace musterr $CLI auth login --host $DATABRICKS_HOST --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
start_login LOG.wrong-code $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code
title "Wrong confirmation code\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001 --confirmation-code AAAA-AAAA
trace AGENT=test-agent musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001 --confirmation-code AAAA-AAAA
# A wrong confirmation code leaves the device code valid, so the pending
# login is kept.
title "Rerun with the right confirmation code\n"
trace $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code wdjb-0001 --confirmation-code ftfa-qqky
title "Rerun after the login was completed\n"
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0001 --confirmation-code FTFA-QQKY
# The server discards the device code when the login expires. The fake server
# only discards a device code once it is exchanged, so a pending login restored
# from before the exchange stands in for an expired one. The pending login is
# then deleted.
title "Device code unknown to the server\n"
start_login LOG.expired $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code
trace cp home/.databricks/token-cache.json home/token-cache.pending.json
trace $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0002 --confirmation-code FTFA-QQKY
trace cp home/token-cache.pending.json home/.databricks/token-cache.json
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0002 --confirmation-code FTFA-QQKY
trace cache_keys
# The token gets the scopes of the device authorization, so the second step
# cannot change them.
title "Scopes changed between the steps\n"
start_login LOG.scopes $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --scopes sql
trace musterr $CLI auth login --host $DATABRICKS_HOST --profile test --use-device-code --user-code WDJB-0003 --confirmation-code FTFA-QQKY
trace print_requests.py --oneline //oidc/v1/device/auth //oidc/v1/token