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

Function store_oidc_token

crates/openshell-bootstrap/src/oidc_token.rs:43–54  ·  view source on GitHub ↗

Store an OIDC token bundle for a gateway.

(gateway_name: &str, bundle: &OidcTokenBundle)

Source from the content-addressed store, hash-verified

41
42/// Store an OIDC token bundle for a gateway.
43pub fn store_oidc_token(gateway_name: &str, bundle: &OidcTokenBundle) -> Result<()> {
44 let path = oidc_token_path(gateway_name)?;
45 ensure_parent_dir_restricted(&path)?;
46 let json = serde_json::to_string_pretty(bundle)
47 .into_diagnostic()
48 .wrap_err("failed to serialize OIDC token bundle")?;
49 std::fs::write(&path, json)
50 .into_diagnostic()
51 .wrap_err_with(|| format!("failed to write OIDC token to {}", path.display()))?;
52 set_file_owner_only(&path)?;
53 Ok(())
54}
55
56/// Load a stored OIDC token bundle for a gateway.
57///

Callers 5

ensure_valid_oidc_tokenFunction · 0.85
apply_authFunction · 0.85
completion_grpc_clientFunction · 0.85
gateway_addFunction · 0.85
gateway_loginFunction · 0.85

Calls 3

oidc_token_pathFunction · 0.85
set_file_owner_onlyFunction · 0.85

Tested by

no test coverage detected