hyperlane_plugin_auth/trait.rs
1use super::*;
2
3/// Pluggable asynchronous authenticator resolving a Hyperlane [`Context`] into an [`AuthPrincipal`].
4pub trait Authenticator: Send + Sync + 'static {
5 /// Authenticates the incoming request represented by `ctx`.
6 ///
7 /// # Arguments
8 ///
9 /// - `&'a self` - Shared reference to self.
10 /// - `&'a Context` - Incoming request context.
11 ///
12 /// # Returns
13 ///
14 /// - `AuthFuture<'a>` - Future resolving to the verified [`AuthPrincipal`] or [`AuthError`].
15 fn authenticate<'a>(&'a self, ctx: &'a Context) -> AuthFuture<'a>;
16}