| 28 | /// `Arc<dyn Authenticator>` inside an [`AuthenticatorChain`]). |
| 29 | #[async_trait] |
| 30 | pub trait Authenticator: Send + Sync + 'static { |
| 31 | /// Inspect an inbound request and return the authenticated principal. |
| 32 | /// |
| 33 | /// - `Ok(Some(principal))` — this authenticator recognized the caller. |
| 34 | /// The chain stops and the principal is inserted into request |
| 35 | /// extensions. |
| 36 | /// - `Ok(None)` — this authenticator does not apply (e.g. no Bearer |
| 37 | /// token for an OIDC authenticator). The chain falls through to |
| 38 | /// the next authenticator. |
| 39 | /// - `Err(status)` — this authenticator applies but rejected the |
| 40 | /// caller. The chain terminates and the status is returned to the |
| 41 | /// client. Fail-closed. |
| 42 | async fn authenticate( |
| 43 | &self, |
| 44 | headers: &http::HeaderMap, |
| 45 | path: &str, |
| 46 | ) -> Result<Option<Principal>, Status>; |
| 47 | } |
| 48 | |
| 49 | /// First-match-wins authenticator chain. |
| 50 | /// |
nothing calls this directly
no outgoing calls
no test coverage detected