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

Function bundle_from_oauth2_response

crates/openshell-cli/src/oidc_auth.rs:289–306  ·  view source on GitHub ↗
(
    resp: &oauth2::basic::BasicTokenResponse,
    issuer: &str,
    client_id: &str,
)

Source from the content-addressed store, hash-verified

287// ── Helpers ──────────────────────────────────────────────────────────
288
289fn bundle_from_oauth2_response(
290 resp: &oauth2::basic::BasicTokenResponse,
291 issuer: &str,
292 client_id: &str,
293) -> OidcTokenBundle {
294 let now = std::time::SystemTime::now()
295 .duration_since(std::time::UNIX_EPOCH)
296 .unwrap_or_default()
297 .as_secs();
298
299 OidcTokenBundle {
300 access_token: resp.access_token().secret().clone(),
301 refresh_token: resp.refresh_token().map(|rt| rt.secret().clone()),
302 expires_at: resp.expires_in().map(|ei| now + ei.as_secs()),
303 issuer: issuer.to_string(),
304 client_id: client_id.to_string(),
305 }
306}
307
308/// Percent-decode a URL query parameter value.
309fn percent_decode(s: &str) -> String {

Callers 4

oidc_browser_auth_flowFunction · 0.85
oidc_refresh_tokenFunction · 0.85

Calls

no outgoing calls

Tested by 1