(
&self,
headers: &http::HeaderMap,
_path: &str,
)
| 204 | #[async_trait] |
| 205 | impl Authenticator for SandboxJwtAuthenticator { |
| 206 | async fn authenticate( |
| 207 | &self, |
| 208 | headers: &http::HeaderMap, |
| 209 | _path: &str, |
| 210 | ) -> Result<Option<Principal>, Status> { |
| 211 | let Some(token) = headers |
| 212 | .get("authorization") |
| 213 | .and_then(|v| v.to_str().ok()) |
| 214 | .and_then(|v| v.strip_prefix("Bearer ")) |
| 215 | else { |
| 216 | return Ok(None); |
| 217 | }; |
| 218 | self.validate_bearer(token) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | #[allow(clippy::result_large_err)] |
no test coverage detected