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

Method authenticate

crates/openshell-server/src/auth/oidc.rs:370–385  ·  view source on GitHub ↗
(
        &self,
        headers: &http::HeaderMap,
        _path: &str,
    )

Source from the content-addressed store, hash-verified

368#[async_trait]
369impl Authenticator for OidcAuthenticator {
370 async fn authenticate(
371 &self,
372 headers: &http::HeaderMap,
373 _path: &str,
374 ) -> Result<Option<Principal>, Status> {
375 let Some(token) = headers
376 .get("authorization")
377 .and_then(|v| v.to_str().ok())
378 .and_then(|v| v.strip_prefix("Bearer "))
379 else {
380 return Ok(None);
381 };
382
383 let identity = self.cache.validate_token(token).await?;
384 Ok(Some(Principal::User(UserPrincipal { identity })))
385 }
386}
387
388#[cfg(test)]

Callers

nothing calls this directly

Calls 2

validate_tokenMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected