Repository navigation
Commit 2eb0880
authored
feat(cli): support OIDC device authorization grant for headless login (NVIDIA#2795)
* feat(cli): support OIDC device authorization grant for headless login
Closes NVIDIA#2793
Add OAuth 2.0 Device Authorization Grant (RFC 8628) support to the OpenShell CLI's OIDC login flow. When running in a headless environment (OPENSHELL_NO_BROWSER=1) without a client secret configured, the CLI now uses the device code flow instead of the browser-based PKCE flow.
The device code flow:
- Requests a device code and user code from the IdP's device authorization endpoint
- Displays a verification URL and user code to the user
- Polls the token endpoint until the user completes authorization or the code expires
- Supports slow_down responses per RFC 8628 by increasing the polling interval
This implementation:
- Extends OidcDiscovery to optionally capture device_authorization_endpoint
- Adds oidc_device_code_flow function with proper error handling for all RFC 8628 error codes
- Updates gateway add and gateway login to dispatch to device flow when browser is suppressed
- Adds comprehensive unit tests for device flow structs and response parsing
- Updates gateway authentication documentation to describe the device code fallback
Signed-off-by: Jesse Jaggars <[email protected]>
* fix(cli): validate OIDC device token responses
Signed-off-by: Jesse Jaggars <[email protected]>
* fix(cli): add PKCE to OIDC device flow
Signed-off-by: Jesse Jaggars <[email protected]>
* docs(cli): document PKCE device flow
Signed-off-by: Jesse Jaggars <[email protected]>
---------
Signed-off-by: Jesse Jaggars <[email protected]>1 parent 3a16012 commit 2eb0880
5 files changed
Lines changed: 451 additions & 8 deletions
File tree
- architecture
- crates/openshell-cli/src
- commands
- docs
- kubernetes
- reference
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
908 | 928 | | |
909 | 929 | | |
910 | 930 | | |
| |||
1129 | 1149 | | |
1130 | 1150 | | |
1131 | 1151 | | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1132 | 1161 | | |
1133 | 1162 | | |
1134 | 1163 | | |
| |||
0 commit comments