Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion architecture/gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Supported auth modes:
| Plaintext | Local development or a trusted reverse proxy boundary. |
| Unauthenticated local users | Trusted Kubernetes dev or fully trusted proxy deployments only. |
| Cloudflare JWT | Edge-authenticated deployments where Cloudflare Access supplies identity. |
| OIDC | Bearer-token auth for users, with browser PKCE or client credentials login. |
| OIDC | Bearer-token auth for users, with browser or device-code PKCE and client credentials login. |

The CLI persists the scopes requested during OIDC login in gateway metadata and
reuses them when refreshing an access token. This preserves the intended API
Expand Down
29 changes: 29 additions & 0 deletions crates/openshell-cli/src/commands/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,26 @@ pub async fn gateway_add(
false
}
}
} else if is_browser_suppressed() {
match crate::oidc_auth::oidc_device_code_flow(
issuer,
oidc_client_id,
oidc_audience,
oidc_scopes,
gateway_insecure,
)
.await
{
Ok(bundle) => {
openshell_bootstrap::oidc_token::store_oidc_token(name, &bundle)?;
eprintln!("{} Authenticated via device code", "✓".green().bold());
true
}
Err(e) => {
eprintln!("{} Authentication failed: {e}", "!".yellow());
false
}
}
} else {
match crate::oidc_auth::oidc_browser_auth_flow(
issuer,
Expand Down Expand Up @@ -1129,6 +1149,15 @@ pub async fn gateway_login(name: &str, gateway_insecure: bool) -> Result<()> {
gateway_insecure,
)
.await?
} else if is_browser_suppressed() {
crate::oidc_auth::oidc_device_code_flow(
issuer,
client_id,
audience,
scopes,
gateway_insecure,
)
.await?
} else {
crate::oidc_auth::oidc_browser_auth_flow(
issuer,
Expand Down
Loading
Loading