MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / gateway_logout

Function gateway_logout

crates/openshell-cli/src/run.rs:1288–1313  ·  view source on GitHub ↗

Clear stored authentication credentials for a gateway.

(name: &str)

Source from the content-addressed store, hash-verified

1286
1287/// Clear stored authentication credentials for a gateway.
1288pub fn gateway_logout(name: &str) -> Result<()> {
1289 let metadata = openshell_bootstrap::load_gateway_metadata(name).map_err(|_| {
1290 miette::miette!(
1291 "Unknown gateway '{name}'.\n\
1292 List available gateways: openshell gateway select"
1293 )
1294 })?;
1295
1296 match metadata.auth_mode.as_deref() {
1297 Some("oidc") => {
1298 openshell_bootstrap::oidc_token::remove_oidc_token(name)?;
1299 }
1300 Some("cloudflare_jwt") => {
1301 openshell_bootstrap::edge_token::remove_edge_token(name)?;
1302 }
1303 _ => {
1304 return Err(miette::miette!(
1305 "Gateway '{name}' uses {} authentication — no stored credentials to clear.",
1306 metadata.auth_mode.as_deref().unwrap_or("mtls")
1307 ));
1308 }
1309 }
1310
1311 eprintln!("{} Logged out of gateway '{name}'", "✓".green().bold());
1312 Ok(())
1313}
1314
1315/// List all registered gateways.
1316pub fn gateway_list(gateway_flag: &Option<String>, output: &str) -> Result<()> {

Callers 1

mainFunction · 0.85

Calls 3

load_gateway_metadataFunction · 0.85
remove_oidc_tokenFunction · 0.85
remove_edge_tokenFunction · 0.85

Tested by

no test coverage detected