(
&self,
headers: &http::HeaderMap,
_path: &str,
)
| 368 | #[async_trait] |
| 369 | impl 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)] |
nothing calls this directly
no test coverage detected