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

Function _read_oidc_token_bundle

python/openshell/sandbox.py:841–853  ·  view source on GitHub ↗

Read and parse `oidc_token.json` for a gateway. Returns the parsed dict, or `None` if the file is absent or unreadable. See `openshell-bootstrap::oidc_token::store_oidc_token` for the writer.

(gateway_dir: pathlib.Path)

Source from the content-addressed store, hash-verified

839
840
841def _read_oidc_token_bundle(gateway_dir: pathlib.Path) -> dict | None:
842 """Read and parse `oidc_token.json` for a gateway.
843
844 Returns the parsed dict, or `None` if the file is absent or unreadable.
845 See `openshell-bootstrap::oidc_token::store_oidc_token` for the writer.
846 """
847 token_path = gateway_dir / "oidc_token.json"
848 try:
849 return json.loads(token_path.read_text(encoding="utf-8"))
850 except FileNotFoundError:
851 return None
852 except (OSError, UnicodeDecodeError, json.JSONDecodeError):
853 return None
854
855
856def _normalize_issuer(bundle: dict) -> str | None:

Calls

no outgoing calls